-
Notifications
You must be signed in to change notification settings - Fork 360
ci: move concurrency dedup from trigger to review workflow #2789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,10 @@ on: | |
| workflows: ["PR Review - Trigger"] | ||
| types: [completed] | ||
|
|
||
| concurrency: | ||
| group: pr-review-${{ github.event.issue.number || github.event.workflow_run.pull_requests[0].number || github.run_id }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LOW] Issue numbers and PR numbers share the same concurrency group key namespace GitHub issues and PRs share a single number sequence per repository. An The workflow-level Suggestion: Distinguish event sources in the group key, e.g.: group: pr-review-${{ github.event_name }}-${{ github.event.issue.number || github.event.workflow_run.pull_requests[0].number || github.run_id }}This limits any cancellation to runs of the same event type, though the fork-PR limitation still applies to |
||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read # Required at top-level to give `issue_comment` events access to the secrets below. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[MEDIUM] Fork PR
workflow_runevents fall back torun_id, defeating deduplicationFor fork PRs — which are the primary use-case for the trigger-based
workflow_runpath — GitHub deliberately leavesworkflow_run.pull_requestsas an empty array for security reasons. As a result,github.event.workflow_run.pull_requests[0].numberevaluates to empty in a GitHub Actions expression, and||falls through togithub.run_id.Because
run_idis unique per run, every fork-PR review run lands in its own concurrency group, makingcancel-in-progress: truecompletely ineffective for fork PRs. Ifopened+review_requestedfire back-to-back for a fork PR (the exact scenario this PR aims to fix), bothpr-review.ymlruns will proceed independently instead of the first being cancelled.Suggested fix: extract the PR number earlier in the workflow — e.g., store it in the context artifact during
save-contextand pass it as a workflow input — or use ajqexpression on the artifact file to derive the group key.Alternatively, a workaround for the
workflow_runpath is to parse the PR number out of the triggering workflow's inputs/artifacts rather than relying onworkflow_run.pull_requests.