Skip to content

Commit 94d4e7f

Browse files
ulixius9claude
andauthored
fix(ci): don't cancel/rerun PR CI when an unrelated label is added (open-metadata#28737)
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>
1 parent 01bd98c commit 94d4e7f

19 files changed

Lines changed: 37 additions & 36 deletions

.github/workflows/airflow-apis-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ permissions:
2323

2424
concurrency:
2525
group: airflow-apis-tests-${{ github.event.pull_request.number || github.run_id }}
26-
cancel-in-progress: true
26+
cancel-in-progress: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test' }}
2727

2828
env:
2929
SONAR_OPTS: >-
@@ -37,7 +37,7 @@ env:
3737
jobs:
3838
airflow-apis-tests:
3939
runs-on: ubuntu-latest
40-
if: ${{ !github.event.pull_request.draft }}
40+
if: ${{ !github.event.pull_request.draft && (github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test') }}
4141
steps:
4242
- name: Free Disk Space (Ubuntu)
4343
uses: jlumbroso/free-disk-space@main

.github/workflows/integration-tests-mysql-elasticsearch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ permissions:
3434

3535
concurrency:
3636
group: integration-tests-mysql-es-${{ github.event.pull_request.number || github.run_id }}
37-
cancel-in-progress: true
37+
cancel-in-progress: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test' }}
3838
jobs:
3939
# Detect whether relevant paths changed. When no matching files are modified
4040
# the downstream job is skipped via its `if` condition.
4141
# A job skipped by `if` reports as "Success", so required checks still pass.
4242
changes:
4343
name: Detect Changes
4444
runs-on: ubuntu-latest
45-
if: ${{ !github.event.pull_request.draft }}
45+
if: ${{ !github.event.pull_request.draft && (github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test') }}
4646
outputs:
4747
backend: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.filter.outputs.backend }}
4848
steps:

.github/workflows/integration-tests-postgres-elasticsearch-redis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ permissions:
4949

5050
concurrency:
5151
group: integration-tests-pg-es-redis-${{ github.event.pull_request.number || github.run_id }}
52-
cancel-in-progress: true
52+
cancel-in-progress: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test' }}
5353
jobs:
5454
# Detect whether relevant paths changed. When no matching files are modified
5555
# the downstream job is skipped via its `if` condition.
5656
# A job skipped by `if` reports as "Success", so required checks still pass.
5757
changes:
5858
name: Detect Changes
5959
runs-on: ubuntu-latest
60-
if: ${{ !github.event.pull_request.draft }}
60+
if: ${{ !github.event.pull_request.draft && (github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test') }}
6161
outputs:
6262
backend: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.filter.outputs.backend }}
6363
steps:

.github/workflows/integration-tests-postgres-opensearch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ permissions:
3434

3535
concurrency:
3636
group: integration-tests-pg-os-${{ github.event.pull_request.number || github.run_id }}
37-
cancel-in-progress: true
37+
cancel-in-progress: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test' }}
3838
jobs:
3939
# Detect whether relevant paths changed. When no matching files are modified
4040
# the downstream job is skipped via its `if` condition.
4141
# A job skipped by `if` reports as "Success", so required checks still pass.
4242
changes:
4343
name: Detect Changes
4444
runs-on: ubuntu-latest
45-
if: ${{ !github.event.pull_request.draft }}
45+
if: ${{ !github.event.pull_request.draft && (github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test') }}
4646
outputs:
4747
backend: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.filter.outputs.backend }}
4848
steps:

.github/workflows/java-checkstyle.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ permissions:
3030

3131
concurrency:
3232
group: java-checkstyle-${{ github.event.pull_request.number || github.run_id }}
33-
cancel-in-progress: true
33+
cancel-in-progress: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test' }}
3434
jobs:
3535
java-checkstyle:
3636
runs-on: ubuntu-latest
37+
if: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test' }}
3738
permissions:
3839
pull-requests: write
3940

.github/workflows/maven-build-collate.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ permissions:
4646

4747
concurrency:
4848
group: maven-build-collate-${{ github.event.pull_request.number || github.run_id }}
49-
cancel-in-progress: true
49+
cancel-in-progress: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test' }}
5050
jobs:
5151
maven-collate-ci:
5252
runs-on: ubuntu-latest
53-
if: ${{ !github.event.pull_request.draft }}
53+
if: ${{ !github.event.pull_request.draft && (github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test') }}
5454
steps:
5555
- name: Wait for the labeler
5656
uses: lewagon/wait-on-check-action@v1.7.0

.github/workflows/maven-sonar-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ permissions:
3333

3434
concurrency:
3535
group: maven-sonar-build-${{ github.event.pull_request.number || github.run_id }}
36-
cancel-in-progress: true
36+
cancel-in-progress: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test' }}
3737
jobs:
3838
maven-sonarcloud-ci:
3939
runs-on: ubuntu-latest
40-
if: ${{ !github.event.pull_request.draft }}
40+
if: ${{ !github.event.pull_request.draft && (github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test') }}
4141
steps:
4242
- name: Wait for the labeler
4343
uses: lewagon/wait-on-check-action@v1.7.0

.github/workflows/playwright-integration-tests-mysql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ on:
1919

2020
concurrency:
2121
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
22-
cancel-in-progress: true
22+
cancel-in-progress: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test' }}
2323

2424
jobs:
2525
playwright-mysql:
2626
runs-on: ubuntu-latest
27-
if: ${{ !github.event.pull_request.draft }}
27+
if: ${{ !github.event.pull_request.draft && (github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test') }}
2828
strategy:
2929
fail-fast: false
3030
matrix:

.github/workflows/playwright-integration-tests-postgres.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ on:
1919

2020
concurrency:
2121
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
22-
cancel-in-progress: true
22+
cancel-in-progress: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test' }}
2323

2424
jobs:
2525
playwright-postgresql:
2626
runs-on: ubuntu-latest
27-
if: ${{ !github.event.pull_request.draft }}
27+
if: ${{ !github.event.pull_request.draft && (github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test') }}
2828
strategy:
2929
fail-fast: false
3030
matrix:

.github/workflows/playwright-mysql-e2e.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ permissions:
3636

3737
concurrency:
3838
group: playwright-ci-pr-mysql-${{ github.event.pull_request.number || github.run_id }}
39-
cancel-in-progress: true
39+
cancel-in-progress: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test' }}
4040

4141
jobs:
4242
playwright-ci-mysql:
4343
runs-on: ubuntu-latest
44-
if: ${{ !github.event.pull_request.draft }}
44+
if: ${{ !github.event.pull_request.draft && (github.event_name != 'pull_request_target' || github.event.action != 'labeled' || github.event.label.name == 'safe to test') }}
4545
environment: test
4646
env:
4747
# Playwright logs the admin user in many times (performAdminLogin per test, parallel

0 commit comments

Comments
 (0)