fix(ci): don't cancel/rerun PR CI when an unrelated label is added#28737
fix(ci): don't cancel/rerun PR CI when an unrelated label is added#28737ulixius9 wants to merge 1 commit into
Conversation
Every PR-CI workflow triggers on `pull_request_target` with `types: [..., labeled]` and used `cancel-in-progress: true`. Adding any label fired a `labeled` event that joined the same concurrency group and cancelled the in-flight run; because the PR already carried `safe to test`, the new run's label gate passed and it reran everything. So adding a label like `to release` needlessly cancelled and restarted CI. Gate on the `safe to test` label in two places per workflow: - concurrency `cancel-in-progress` is now an expression that stays false for `labeled` events unless the added label is `safe to test`, so an unrelated label no longer cancels the running build. - the gateway job's `if` carries the same clause, so an unrelated label doesn't spawn a duplicate run (downstream `needs:` jobs skip as they already do for draft PRs). `push`/`merge_group`/`workflow_dispatch` are unaffected via the `event_name != 'pull_request_target'` clause. team-labeler and auto-cherry-pick (which intentionally act on labels) are left untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ ApprovedUpdates CI concurrency and gateway logic to ignore unrelated label changes, preventing unnecessary workflow cancellations and restarts. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
There was a problem hiding this comment.
Pull request overview
This PR updates OpenMetadata’s PR CI GitHub Actions workflows to prevent in-flight CI runs from being cancelled/restarted when unrelated labels are added to a PR, while preserving the intended behavior for the safe to test gating label.
Changes:
- Makes workflow-level
concurrency.cancel-in-progressconditional sopull_request_targetlabeled events only cancel in-progress runs when the added label issafe to test. - Adds/updates an equivalent “gateway job”
if:condition so unrelated label events don’t spawn duplicate workflow runs (downstreamneeds:jobs remain skipped as usual). - Applies the pattern across 19 affected PR-CI workflows (leaving label-driven automation workflows untouched, per PR description).
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/airflow-apis-tests.yml | Conditional concurrency + job gate to avoid reruns on unrelated PR labels. |
| .github/workflows/integration-tests-mysql-elasticsearch.yml | Conditional concurrency + gateway changes job gate for label events. |
| .github/workflows/integration-tests-postgres-elasticsearch-redis.yml | Conditional concurrency + gateway changes job gate for label events. |
| .github/workflows/integration-tests-postgres-opensearch.yml | Conditional concurrency + gateway changes job gate for label events. |
| .github/workflows/java-checkstyle.yml | Conditional concurrency and job-level gate to avoid reruns on unrelated PR labels. |
| .github/workflows/maven-build-collate.yml | Conditional concurrency + job gate to avoid reruns on unrelated PR labels. |
| .github/workflows/maven-sonar-build.yml | Conditional concurrency + job gate to avoid reruns on unrelated PR labels. |
| .github/workflows/playwright-integration-tests-mysql.yml | Conditional concurrency + job gate to avoid reruns on unrelated PR labels. |
| .github/workflows/playwright-integration-tests-postgres.yml | Conditional concurrency + job gate to avoid reruns on unrelated PR labels. |
| .github/workflows/playwright-mysql-e2e.yml | Conditional concurrency + job gate to avoid reruns on unrelated PR labels. |
| .github/workflows/playwright-postgresql-e2e.yml | Conditional concurrency + job gate to avoid reruns on unrelated PR labels. |
| .github/workflows/playwright-sso-tests.yml | Conditional concurrency + job gate to avoid reruns on unrelated PR labels. |
| .github/workflows/py-checkstyle.yml | Conditional concurrency + job gate to avoid reruns on unrelated PR labels. |
| .github/workflows/py-operator-build-test.yml | Conditional concurrency + job gate to avoid reruns on unrelated PR labels. |
| .github/workflows/py-tests-postgres.yml | Conditional concurrency + gateway changes job gate for label events. |
| .github/workflows/py-tests.yml | Conditional concurrency + gateway changes job gate for label events. |
| .github/workflows/typescript-type-generation.yml | Conditional concurrency + job gate to avoid reruns on unrelated PR labels. |
| .github/workflows/ui-checkstyle.yml | Conditional concurrency updated; existing job authorization gate already handled label events. |
| .github/workflows/yarn-coverage.yml | Conditional concurrency + job gate to avoid reruns on unrelated PR labels. |
Problem
Adding any label to a PR cancels the in-flight CI run and restarts it. This makes sense for
safe to test(the label that gates CI), but not for labels liketo release— there's no reason to cancel and rerun the whole pipeline.Root cause
Every PR-CI workflow triggers on
pull_request_targetwithtypes: [..., labeled]and used:Adding a label fires a
labeledevent → the new run joins the same concurrency group →cancel-in-progress: truekills the running build. And because the PR already carriessafe to test(that's why CI was running), the new run'sVerify PR labelsstep passes and it reruns everything.Fix
Two parts per workflow, both gated on the
safe to testlabel:cancel-in-progressis now an expression that staysfalseforlabeledevents unless the added label issafe to test, so an unrelated label no longer cancels the running build:if— the same clause, so an unrelated label doesn't spawn a duplicate run. Downstreamneeds:jobs skip automatically, exactly as they already do for draft PRs.push/merge_group/workflow_dispatchare unaffected via theevent_name != 'pull_request_target'clause.Behavior after
safe to test→ CI runs (and cancel-on-new-push still works) — unchanged.to release/ any other label → the running CI is not cancelled and no duplicate run starts.Scope
pull_request_target+labeledworkflows updated (ui-checkstyle.ymlalready had the job gate, so it only needed the concurrency line).team-labeler.ymlandauto-cherry-pick-labeled-prs.yaml(these intentionally act on labels), and the*-e2e-skip.ymlshims (no concurrency).🤖 Generated with Claude Code