Fix CI concurrency collision between scheduled runs and fork PRs (#18826)

This commit is contained in:
Alison Shao
2026-02-14 10:48:31 +08:00
committed by GitHub
parent 066b0b70d9
commit 8ef3e3d56b
+4 -3
View File
@@ -52,12 +52,13 @@ on:
default: false
concurrency:
# Concurrency group structure: pr-test-{branch}-{pr_sha}-{stage}
# Concurrency group structure: pr-test-{event}-{branch}-{pr_sha}-{stage}
# - event_name prevents scheduled runs from colliding with fork PRs whose branch is named 'main'
# (without it, both resolve the branch segment to 'main' and block each other)
# - github.head_ref (pull_request) or github.ref_name (workflow_dispatch) normalizes to branch name
# - pr_head_sha isolates /rerun-stage from main branch runs
# - target_stage allows parallel stage dispatches to run independently
# This ensures pull_request and workflow_dispatch on same branch cancel each other
group: pr-test-${{ github.head_ref || github.ref_name || 'default' }}-${{ inputs.pr_head_sha || 'current' }}-${{ inputs.target_stage || inputs.ref || 'all' }}
group: pr-test-${{ github.event_name }}-${{ github.head_ref || github.ref_name || 'default' }}-${{ inputs.pr_head_sha || 'current' }}-${{ inputs.target_stage || inputs.ref || 'all' }}
cancel-in-progress: ${{ github.event_name != 'workflow_call' }}
env: