[PM-32200] ci: Add workflow to enforce PR labels#6530
[PM-32200] ci: Add workflow to enforce PR labels#6530
Conversation
|
Claude finished @vvolkgang's task in 2m 47s —— View job Re-Review: SDLC / Enforce PR LabelsScope: One new commit since last review -- AssessmentThe sleep removal is a good change. Instead of a racy
This is cleaner and more reliable than the sleep approach. GitHub required status checks use the latest run result, so the final state is always correct. Previously Noted (unchanged, low severity)
VerdictNo issues found. The workflow is clean and correctly implements PR label enforcement. Approving. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6530 +/- ##
==========================================
- Coverage 86.35% 86.31% -0.04%
==========================================
Files 789 790 +1
Lines 56424 56525 +101
Branches 8175 8175
==========================================
+ Hits 48724 48791 +67
- Misses 4853 4887 +34
Partials 2847 2847 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Great job! No new security vulnerabilities introduced in this pull request |
|
|
||
| on: | ||
| pull_request: | ||
| types: [labeled, unlabeled, opened, reopened, edited, synchronize] |
There was a problem hiding this comment.
nit: synchronize is misspelled — should be synchronize. Actually, looking again this is the correct GitHub Actions event name (synchronize, not synchronized). Disregard!
Wait — I re-read this: the value here is synchronize which is the correct GitHub event type. No issue here. Apologies for the noise.
|
|
||
| - name: Allow labeler to run on opened PRs | ||
| if: github.event.action == 'opened' || github.event.action == 'reopened' | ||
| run: sleep 15 |
There was a problem hiding this comment.
Question: The sleep 15 is a reasonable approach to give the labeler workflow time to apply labels, but it introduces a race condition — if the labeler takes longer than 15 seconds (e.g., due to runner queue delays or slow API calls), the enforce step could still run before labels are applied.
Have you considered an alternative approach, such as:
- Making this workflow depend on the labeler workflow completing (using
workflow_runtrigger)? - Using a polling loop that checks for
t:*labels with a timeout?
The sleep approach is pragmatic and will likely work most of the time, but it's worth calling out as a known trade-off.
| echo "⏭️ Skipping type label check - 'ignore-for-release' label present" | ||
| exit 0 | ||
| fi | ||
| _T_LABEL_COUNT=$(echo "$_PR_LABELS" | jq '[.[] | select(.name | startswith("t:"))] | length') |
There was a problem hiding this comment.
Note: The jq command here depends on jq being available on the runner. This is fine for ubuntu-24.04 (it's pre-installed), but worth noting as an implicit dependency. If the runner image ever changes, this could break silently.
Also, the toJSON() output is passed through an environment variable ($_PR_LABELS). For PRs with many labels or labels containing special characters, this should be safe since jq handles JSON parsing, but it's good that you're not trying to do string matching here.

🎟️ Tracking
PM-32200
📔 Objective
Add workflow that enforces PR labeling requirements, by failing a run when: