ci: scope labeler concurrency group to the PR#25236
Conversation
The labeler workflow runs on pull_request_target, where github.ref resolves to the base branch (refs/heads/main) rather than the PR head. With the previous concurrency group of `workflow-github.ref`, every labeler run across all open PRs shared a single group, so cancel-in-progress cancelled in-flight runs whenever another PR triggered the workflow at nearly the same time. PRs created or updated in quick succession were left unlabeled. Key the concurrency group on the PR number instead, falling back to github.ref for non-PR contexts, so each PR gets its own group. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for docsdocker ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The concurrency group fix is correct. Keying on github.event.pull_request.number (with || github.ref fallback) properly isolates each PR's labeler run, so cancel-in-progress: true only cancels a stale run for the same PR rather than for any open PR.
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
There was a problem hiding this comment.
I see in other repositories, we just use;
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}maybe the github.ref is redundant? (combined with the cancel-in-progress`)?
There was a problem hiding this comment.
Yeah, perhaps would be good to use the same; I also see a zizmor comment (but not sure if we still need that one; the comment itself could be useful for context though);
pull_request_target: # zizmor: ignore[dangerous-triggers] safe here, this workflow only applies labels and never checks out or executes PR codeThere was a problem hiding this comment.
Good call — dropped the github.ref fallback in ba31bc5, so the group is now just ${{ github.workflow }}-${{ github.event.pull_request.number }} to match the other repos. Since the workflow only triggers on pull_request_target, pull_request.number is always set and the fallback was dead weight.
There was a problem hiding this comment.
Added the zizmor ignore comment too (ba31bc5), with the context note on why the trigger is safe here (applies labels only, never checks out or executes PR code).
Use the same concurrency group pattern as other Docker repos (github.event.pull_request.number alone); the github.ref fallback is redundant for a pull_request_target-only workflow. Also add a zizmor ignore comment documenting why the pull_request_target trigger is safe here (labels only, no checkout or execution of PR code). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
thaJeztah
left a comment
There was a problem hiding this comment.
changes LGTM; can you squash the commits?
Problem
The labeler workflow has been silently skipping labels on some PRs. The runs show up as
cancelledrather thansuccess.Root cause is the concurrency config:
The workflow triggers on
pull_request_target, and for that eventgithub.refresolves to the base branch (refs/heads/main), not the PR head ref. So every labeler run across all open PRs lands in the same concurrency group (labeler-refs/heads/main), andcancel-in-progress: truekills whichever run is in flight as soon as another PR triggers the workflow.When several PRs are created or updated within seconds of each other, the earlier runs get cancelled before they finish labeling. Example from recent runs:
sbx-policy-recipes(cancelled) ← cancelled byremove-api-header(success) seconds latersbx-linux-keychain(cancelled) ← cancelled bystorage-drivers(success) seconds laterFix
Key the concurrency group on the PR number instead, falling back to
github.reffor non-PR contexts, so each PR gets its own group and runs no longer cancel each other.Note
A separate, rarer class of labeler failures (genuine
failurestatus) was caused by transient GitHub infrastructure errors downloading the pinned action tarball at the "Set up job" step. Those are not addressed here as they only need a re-run.🤖 Generated with Claude Code