Skip to content

fix(ci): prevent duplicate pr-audit triggers on multi-label events#2859

Merged
legion2002 merged 2 commits intomainfrom
fix/pr-audit-duplicate-triggers
Feb 25, 2026
Merged

fix(ci): prevent duplicate pr-audit triggers on multi-label events#2859
legion2002 merged 2 commits intomainfrom
fix/pr-audit-duplicate-triggers

Conversation

@legion2002
Copy link
Contributor

Problem

When multiple labels are added to a PR simultaneously (e.g., C-enhancement, A-precompile, agentic-audit), GitHub fires a separate labeled event for each label. The old if condition checked whether the PR has the agentic-audit label:

if: contains(github.event.pull_request.labels.*.name, 'agentic-audit')

Since all three events see the PR already has the label, all three pass the condition and trigger an audit. This is what happened on PR #2857 — 3 Ralph comments were posted.

Fix

Check github.event.label.name (the label from the current event) instead:

if: github.event.label.name == 'agentic-audit' && github.event.pull_request.draft == false

Only the event where agentic-audit is the label being added will trigger the audit.

When multiple labels are added simultaneously, GitHub fires a separate
labeled event per label. The old condition checked if the PR *has* the
agentic-audit label, which is true for all events. This caused N audit
runs for N labels added at once (e.g., 3 comments on PR #2857).

Fix: check github.event.label.name instead of scanning all labels.
@legion2002 legion2002 requested a review from a team February 25, 2026 17:26
Draft PRs with the agentic-audit label should still trigger the audit.
The draft check was blocking early security feedback.
@legion2002 legion2002 enabled auto-merge February 25, 2026 18:15
@legion2002 legion2002 added this pull request to the merge queue Feb 25, 2026
Merged via the queue into main with commit e1350a2 Feb 25, 2026
32 of 36 checks passed
@legion2002 legion2002 deleted the fix/pr-audit-duplicate-triggers branch February 25, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants