Skip to content

fix(ci): don't cancel/rerun PR CI when an unrelated label is added#28737

Open
ulixius9 wants to merge 1 commit into
mainfrom
malpais-granite
Open

fix(ci): don't cancel/rerun PR CI when an unrelated label is added#28737
ulixius9 wants to merge 1 commit into
mainfrom
malpais-granite

Conversation

@ulixius9
Copy link
Copy Markdown
Member

@ulixius9 ulixius9 commented Jun 5, 2026

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 like to release — there's no reason to cancel and rerun the whole pipeline.

Root cause

Every PR-CI workflow triggers on pull_request_target with types: [..., labeled] and used:

concurrency:
  group: <name>-${{ github.event.pull_request.number || github.run_id }}
  cancel-in-progress: true

Adding a label fires a labeled event → the new run joins the same concurrency group → cancel-in-progress: true kills the running build. And because the PR already carries safe to test (that's why CI was running), the new run's Verify PR labels step passes and it reruns everything.

Fix

Two parts per workflow, both gated on the safe to test label:

  1. Concurrencycancel-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:
    cancel-in-progress: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test' }}
  2. Gateway job if — the same clause, so an unrelated label doesn't spawn a duplicate run. Downstream needs: jobs skip automatically, exactly as they already do for draft PRs.

push / merge_group / workflow_dispatch are unaffected via the event_name != 'pull_request_target' clause.

Behavior after

  • Add safe to test → CI runs (and cancel-on-new-push still works) — unchanged.
  • Add to release / any other label → the running CI is not cancelled and no duplicate run starts.

Scope

  • 19 pull_request_target + labeled workflows updated (ui-checkstyle.yml already had the job gate, so it only needed the concurrency line).
  • Left untouched: team-labeler.yml and auto-cherry-pick-labeled-prs.yaml (these intentionally act on labels), and the *-e2e-skip.yml shims (no concurrency).
  • All 19 files validated as parseable YAML.

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings June 5, 2026 07:34
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Add a closing reference such as Fixes #12345 to the PR description (accepted keywords: Fixes, Closes, Resolves).

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 skip-pr-checks label.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Jun 5, 2026
@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Jun 5, 2026

Code Review ✅ Approved

Updates CI concurrency and gateway logic to ignore unrelated label changes, preventing unnecessary workflow cancellations and restarts. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-progress conditional so pull_request_target labeled events only cancel in-progress runs when the added label is safe to test.
  • Adds/updates an equivalent “gateway job” if: condition so unrelated label events don’t spawn duplicate workflow runs (downstream needs: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants