From e280108dbb07395cffddcc3551d64b142e193656 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 26 Dec 2024 17:54:16 -0500 Subject: [PATCH] Update cla.yml --- .github/workflows/cla.yml | 64 +++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 37 deletions(-) diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 13cdd456..9d2cfae9 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -17,10 +17,7 @@ jobs: - name: "CLA Assistant" id: cla_assistant_step - if: > - (github.event_name == 'issue_comment' && contains(github.event.comment.body || '', 'recheck')) || - (github.event_name == 'issue_comment' && contains(github.event.comment.body || '', 'I have read the CLA Document and I hereby sign the CLA')) || - github.event_name == 'pull_request_target' + if: (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: ${{ steps.create_token.outputs.token }} @@ -33,56 +30,49 @@ jobs: remote-organization-name: 'open-domains' remote-repository-name: 'cla' lock-pullrequest-aftermerge: false - + - name: Re-run CLA Check if "recheck" - if: > - github.event_name == 'issue_comment' && contains(github.event.comment.body || '', 'recheck') + if: github.event.comment.body == 'recheck' uses: actions/github-script@v6 with: - script: | - const octokit = github.getOctokit(process.env.GITHUB_TOKEN) - const { data: checkRuns } = await octokit.rest.checks.listForRef({ + script: | + const octokit = github.getOctokit(process.env.GITHUB_TOKEN) + const { data: checkRuns } = await octokit.rest.checks.listForRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: context.sha, + check_name: 'CLA / CLAAssistant (pull_request_target)' + }); + if(checkRuns.total_count > 0){ + const checkRunId = checkRuns.check_runs[0].id; + await octokit.rest.checks.rerequestCheckRun({ owner: context.repo.owner, repo: context.repo.repo, - ref: context.sha, - check_name: 'CLA / CLAAssistant (pull_request_target)' + check_run_id: checkRunId }); - if(checkRuns.total_count > 0){ - const checkRunId = checkRuns.check_runs[0].id; - await octokit.rest.checks.rerequestCheckRun({ - owner: context.repo.owner, - repo: context.repo.repo, - check_run_id: checkRunId - }); - console.log("CLA check re-run has been triggered") - } else { - console.log("CLA check not found") - } + console.log("CLA check re-run has been triggered") + } else { + console.log("CLA check not found") + } env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Add CLA Signed + - name: add CLA signed uses: actions-ecosystem/action-add-labels@v1 - if: > - (github.event_name == 'issue_comment' && contains(github.event.comment.body || '', 'recheck')) || - (github.event_name == 'issue_comment' && contains(github.event.comment.body || '', 'I have read the CLA Document and I hereby sign the CLA')) || - github.event_name == 'pull_request_target' + if: (github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' with: labels: "CLA Signed" github_token: ${{ steps.create_token.outputs.token }} - - name: Remove CLA Required + - name: remove CLA required uses: actions-ecosystem/action-remove-labels@v1 - if: > - (github.event_name == 'issue_comment' && contains(github.event.comment.body || '', 'recheck')) || - (github.event_name == 'issue_comment' && contains(github.event.comment.body || '', 'I have read the CLA Document and I hereby sign the CLA')) || - github.event_name == 'pull_request_target' + if: (github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' with: labels: "CLA Required" - github_token: ${{ steps.create_token.outputs.token }} + github_token: ${{ steps.create_token.outputs.token }} - - name: Add CLA Required on Failure - if: ${{ failure() }} + - if: ${{ failure() }} + name: Add CLA required uses: actions-ecosystem/action-add-labels@v1 with: labels: "CLA Required"