From 87100ce9a8638f27382e464c8dea983fa8991ee7 Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Wed, 26 Feb 2025 15:33:14 -0500 Subject: [PATCH 1/2] Add CLA bot --- .github/workflows/cla.yml | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/cla.yml diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml new file mode 100644 index 0000000..a391dd8 --- /dev/null +++ b/.github/workflows/cla.yml @@ -0,0 +1,54 @@ +name: "CLA Assistant" + +on: + issue_comment: + types: [created] + pull_request_target: + types: [opened, closed, synchronize, labeled] # Added "labeled" event to check for label changes + workflow_dispatch: # Allow manual triggering of the workflow + +permissions: + actions: write + contents: write + pull-requests: write + statuses: write + checks: write + +jobs: + CLAAssistant: + runs-on: ubuntu-latest + steps: + - name: "CLA Assistant" + if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' + uses: contributor-assistant/github-action@v2.6.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_PAT }} + with: + path-to-signatures: 'signatures/version1/cla.json' + path-to-document: 'https://lmstudio.ai/opensource/cla' + remote-organization-name: lmstudio-ai + remote-repository-name: cla-signatures + branch: 'main' + allowlist: yagil,ryan-the-crayon,azisislm,mattjcly,neilmehta24 + + - name: "Label PR as CLA Signed" + if: success() + run: | + if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then + PR_NUMBER="${{ github.event.pull_request.number }}" + elif [[ "${{ github.event_name }}" == "issue_comment" ]]; then + PR_NUMBER="${{ github.event.issue.number }}" + fi + ENDPOINT="https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels" + curl -L -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + -d '{"labels":["CLA signed"]}' \ + $ENDPOINT + curl -L -X DELETE \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels/Request%20CLA" || true \ No newline at end of file From 42413d76d4a65f97379ef49176450b500233883f Mon Sep 17 00:00:00 2001 From: Rugved Somwanshi Date: Wed, 26 Feb 2025 15:33:45 -0500 Subject: [PATCH 2/2] cleanup --- .github/workflows/cla.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index a391dd8..4fa266f 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -51,4 +51,4 @@ jobs: -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ - "https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels/Request%20CLA" || true \ No newline at end of file + "https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels/Request%20CLA" || true