Skip to content

Commit

Permalink
Ensure CLA check gets skipped for Argo (#520)
Browse files Browse the repository at this point in the history
The automatic CLA check isn't working as desired in some cases -- the check is being enforced even though Argo is the PR author. This is happening because the check currently checks if `github.actor` matches the Argo bot username, but `github.actor` is actually _the user who last caused CI to be triggered_, whether by commenting on the PR, pushing changes, etc.

[Here's a good example](https://github.com/Shopify/product-taxonomy/actions/runs/12656103875?pr=510) showing the check being enforced for an Argo PR because the triggering user was someone else.

The fix here is to directly check the PR author, instead of the event actor. This is done slightly differently depending on the event type:
* For a `pull_request_target` event: `github.event.pull_request.user.login`
* For an `issue_comment` event: `github.event.issue.user.login`

https://github.com/orgs/community/discussions/25502 provides more context.
  • Loading branch information
danielpgross authored Jan 7, 2025
2 parents 421f6bf + 3808114 commit 81cae7c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/contributor_license_agreement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ jobs:
actions: write
pull-requests: write
if: |
github.actor != 'argo-translation-integration[bot]'
(
# The PR author is stored differently depending on the event type, see
# https://github.com/orgs/community/discussions/25502
(github.event_name == 'pull_request_target' && github.event.pull_request.user.login != 'argo-translation-integration[bot]')
|| (github.event_name == 'issue_comment' && github.event.issue.user.login != 'argo-translation-integration[bot]')
)
&& (
(github.event.issue.pull_request
&& !github.event.issue.pull_request.merged_at
Expand Down

0 comments on commit 81cae7c

Please sign in to comment.