diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 521e917e..ec3a953c 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -16,10 +16,27 @@ jobs: runs-on: ubuntu-latest steps: - uses: contributor-assistant/github-action@v2.6.1 + # Run on close only if the PR was merged. This will lock the PR to preserve + # the CLA agreement. We don't want to lock PRs that have been closed without + # merging because the contributor may want to respond with additional comments. + # This action has a "lock-pullrequest-aftermerge" option that can be set to false, + # but that would unconditionally skip locking even in cases where the PR was merged. if: | - github.event_name == 'pull_request_target' || - 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' && + ( + github.event.action == 'opened' || + github.event.action == 'synchronize' || + (github.event.action == 'closed' && github.event.pull_request.merged == true) + ) + ) || + ( + github.event_name == 'issue_comment' && + ( + github.event.comment.body == 'recheck' || + github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA' + ) + ) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: