|
| 1 | +name: "CLA Assistant" |
| 2 | + |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created] |
| 6 | + pull_request_target: |
| 7 | + types: [opened, closed, synchronize, labeled] # Added "labeled" event to check for label changes |
| 8 | + workflow_dispatch: # Allow manual triggering of the workflow |
| 9 | + |
| 10 | +permissions: |
| 11 | + actions: write |
| 12 | + contents: write |
| 13 | + pull-requests: write |
| 14 | + statuses: write |
| 15 | + checks: write |
| 16 | + |
| 17 | +jobs: |
| 18 | + CLAAssistant: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: "CLA Assistant" |
| 22 | + 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' |
| 23 | + uses: contributor-assistant/[email protected] |
| 24 | + env: |
| 25 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_PAT }} |
| 27 | + with: |
| 28 | + path-to-signatures: 'signatures/version1/cla.json' |
| 29 | + path-to-document: 'https://lmstudio.ai/opensource/cla' |
| 30 | + remote-organization-name: lmstudio-ai |
| 31 | + remote-repository-name: cla-signatures |
| 32 | + branch: 'main' |
| 33 | + allowlist: yagil,ryan-the-crayon,azisislm,mattjcly,neilmehta24,ncoghlan |
| 34 | + |
| 35 | + - name: "Label PR as CLA Signed" |
| 36 | + if: success() |
| 37 | + run: | |
| 38 | + if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then |
| 39 | + PR_NUMBER="${{ github.event.pull_request.number }}" |
| 40 | + elif [[ "${{ github.event_name }}" == "issue_comment" ]]; then |
| 41 | + PR_NUMBER="${{ github.event.issue.number }}" |
| 42 | + fi |
| 43 | + ENDPOINT="https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels" |
| 44 | + curl -L -X POST \ |
| 45 | + -H "Accept: application/vnd.github+json" \ |
| 46 | + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ |
| 47 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 48 | + -d '{"labels":["CLA signed"]}' \ |
| 49 | + $ENDPOINT |
| 50 | + curl -L -X DELETE \ |
| 51 | + -H "Accept: application/vnd.github+json" \ |
| 52 | + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ |
| 53 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 54 | + "https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels/Request%20CLA" || true |
0 commit comments