ci: trigger pull_request CI on hotfix/** branches, not just release/** (#7148) (#7198)

pr.yml and pr-risk.yml (and the three advisory workflows that already
list release/** beside it -- conformance.yml, cross-version-smoke.yml,
regression.yml) trigger pull_request only on main and release/**. A PR
based on hotfix/1.3.1 (or any sibling hotfix/** line) matched neither
pattern, so it ran almost no CI: #7146, a backport to hotfix/1.3.1,
showed 17 checks -- 15 cross-version historical smokes and triage/label
jobs, 2 skipped -- no Lint, no unit shards, no embedded tier, no CI
Gate / Required, no PR Risk Gate / Required.

pr.yml's own comment states exactly why release/** is there:
release-prep and release-fix PRs are based on the release branch, not
main, and without it they run almost no CI before the tag build. A
hotfix line is in the identical position. Added hotfix/** alongside
release/** in all five files.

New TestPullRequestWorkflowsTriggerOnHotfixBranches pins hotfix/**
presence in each file's pull_request.branches list -- red before this
change (observed [main release/**] in all five), green after. The
existing TestPRRiskBazelCoverageJob equality check (pr.yml and
pr-risk.yml's pull_request triggers must match) still passes, since
both were updated identically. go vet/gofmt clean.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
This commit is contained in:
Rongjun GENG 2026-10-04 20:30:49 -07:00 • committed by GitHub
commit 3c65c99c29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 51 additions and 5 deletions

View file

@ -5,7 +5,7 @@ name: Conformance
on:
pull_request:
branches: [ main, 'release/**' ]
branches: [ main, 'release/**', 'hotfix/**' ]
# "Upgrade-relevant code" allowlist (spec-f7.md §2.4): any non-test Go
# change, build input, or this workflow's own inputs. Kept byte-for-byte
# identical (modulo each workflow's own file/script entries) across

View file

@ -10,7 +10,7 @@ on:
# feedback. Release-targeted PRs are exactly the ones where cross-version
# upgrade breakage is most expensive to discover at tag time.
pull_request:
branches: [ main, 'release/**' ]
branches: [ main, 'release/**', 'hotfix/**' ]
# "Upgrade-relevant code" allowlist (spec-f7.md §2.4): kept identical
# (modulo each workflow's own file/script entries) across conformance.yml,
# migration-test.yml and cross-version-smoke.yml, and pinned by

View file

@ -2,7 +2,7 @@ name: PR Risk
on:
pull_request:
branches: [ main, 'release/**' ]
branches: [ main, 'release/**', 'hotfix/**' ]
merge_group:
concurrency:

View file

@ -5,7 +5,7 @@ on:
# release/** is here because release-prep and release-fix PRs are based on
# the release branch, not on main. Without it they run almost no CI and the
# first full signal is the tag build, where a failure burns the tag.
branches: [ main, 'release/**' ]
branches: [ main, 'release/**', 'hotfix/**' ]
merge_group:
concurrency:

View file

@ -5,7 +5,7 @@ on:
push:
branches: [main]
pull_request:
branches: [main, 'release/**']
branches: [main, 'release/**', 'hotfix/**']
# Allow manual trigger
workflow_dispatch:

View file

@ -37,6 +37,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
the `.githooks` markers and `uv.lock` and leaves any other drifted file as it was.
### Fixed
- **PRs based on `hotfix/**` branches now run full CI, not just
cross-version historical smokes and triage labeling.** `pr.yml`,
`pr-risk.yml`, `conformance.yml`, `cross-version-smoke.yml` and
`regression.yml` all trigger `pull_request` on `main` and `release/**`,
but not on `hotfix/**` — a backport PR based on a hotfix line (the same
position `release/**` was added for) got no unit shards, no lint, no
risk gate, and no required CI Gate at all: 15 passing cross-version
smokes and triage jobs, nothing else. Added `hotfix/**` alongside
`release/**` in all five (#7148).
- **Concurrent `bd init --shared-server` runs in different projects no
longer refuse each other.** Every shared-server project gates the one shared

View file

@ -92,6 +92,42 @@ func TestCIWorkflowArtifactOwnership(t *testing.T) {
}
}
// TestPullRequestWorkflowsTriggerOnHotfixBranches is the #7148 regression.
// pr.yml's own comment states why release/** is in the pull_request
// trigger: "release-prep and release-fix PRs are based on the release
// branch, not on main. Without it they run almost no CI and the first
// full signal is the tag build, where a failure burns the tag." A hotfix
// backport PR (hotfix/1.3.1 and its siblings) is in exactly that position
// — based on a branch other than main — so it needs the same trigger,
// alongside release/**, not instead of it.
func TestPullRequestWorkflowsTriggerOnHotfixBranches(t *testing.T) {
type triggers struct {
On struct {
PullRequest struct {
Branches []string `yaml:"branches"`
} `yaml:"pull_request"`
} `yaml:"on"`
}
root := sourceRepoRoot(t)
for _, name := range []string{
"pr.yml", prRiskWorkflowName, "conformance.yml", "cross-version-smoke.yml", "regression.yml",
} {
t.Run(name, func(t *testing.T) {
var doc triggers
if err := yaml.Unmarshal([]byte(readPolicyFile(t, root, ".github/workflows/"+name)), &doc); err != nil {
t.Fatal(err)
}
branches := doc.On.PullRequest.Branches
if !slices.Contains(branches, "release/**") {
t.Fatalf("%s pull_request.branches = %v, want release/** present (this test asserts the baseline it extends)", name, branches)
}
if !slices.Contains(branches, "hotfix/**") {
t.Errorf("%s pull_request.branches = %v, want hotfix/** alongside release/** — a hotfix backport PR is based on a branch other than main, same as a release-prep PR", name, branches)
}
})
}
}
func TestPRCIGateRequiresPolicyAndLintWrappers(t *testing.T) {
gate := readCIWorkflow(t, "pr.yml").job(t, "ci-gate")
gateEnv := gate.step(t, "Evaluate CI gate").Env