Skip to content

ci: scope labeler concurrency group to the PR#25236

Merged
dvdksn merged 2 commits into
docker:mainfrom
dvdksn:labeler-concurrency-per-pr
Jun 2, 2026
Merged

ci: scope labeler concurrency group to the PR#25236
dvdksn merged 2 commits into
docker:mainfrom
dvdksn:labeler-concurrency-per-pr

Conversation

@dvdksn
Copy link
Copy Markdown
Contributor

@dvdksn dvdksn commented Jun 2, 2026

Problem

The labeler workflow has been silently skipping labels on some PRs. The runs show up as cancelled rather than success.

Root cause is the concurrency config:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

The workflow triggers on pull_request_target, and for that event github.ref resolves 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), and cancel-in-progress: true kills 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 by remove-api-header (success) seconds later
  • sbx-linux-keychain (cancelled) ← cancelled by storage-drivers (success) seconds later

Fix

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 and runs no longer cancel each other.

group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

Note

A separate, rarer class of labeler failures (genuine failure status) 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

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>
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 2, 2026

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit ba31bc5
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/6a1eb4ba00b5850008022739
😎 Deploy Preview https://deploy-preview-25236--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added area/release Relates to CI or deployment ci ci updates labels Jun 2, 2026
Copy link
Copy Markdown

@docker-agent docker-agent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dvdksn dvdksn requested a review from a team June 2, 2026 10:39
Comment thread .github/workflows/labeler.yml Outdated

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very possible 🤷 😅

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes LGTM; can you squash the commits?

@dvdksn dvdksn merged commit 0e54dc9 into docker:main Jun 2, 2026
16 checks passed
@dvdksn dvdksn deleted the labeler-concurrency-per-pr branch June 2, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/release Relates to CI or deployment ci ci updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants