Skip to content

Commit 0c67ac5

Browse files
committed
ci: run PR checks on dev2-go, so an accepted PR is also a checked one
Opening the target gate without this leaves a worse state than before: a dev2-go PR passes the gate, shows no checks, and looks reviewable with nothing behind it. Both pull_request triggers selected [main, dev] only. The push trigger stays narrow on purpose. dev2-go is an integration line, not a release-promotion source, and release.yml gates on main and preview — adding dev2-go there would put it in that path. The new test reads the allow-list out of enforce-pr-target.yml and requires the two PR branch lists to match it plus main, so the three files cannot drift apart silently. Renaming the gate's second base now fails here, which is the point. 50 pass, 531 expect().
1 parent 6466be3 commit 0c67ac5

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Cross-platform CI
22

33
on:
44
pull_request:
5-
branches: [main, dev]
5+
branches: [main, dev, dev2-go]
66
paths:
77
- "src/**"
88
- "bin/**"

‎.github/workflows/service-lifecycle.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Service lifecycle
22

33
on:
44
pull_request:
5-
branches: [main, dev]
5+
branches: [main, dev, dev2-go]
66
paths:
77
- "src/service.ts"
88
# Keep in sync with the release.yml service-gate regex (release.yml "Require

‎tests/ci-workflows.test.ts‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,35 @@ describe("GitHub Actions hardening", () => {
3131
expect(workflow).not.toMatch(/uses:\s+\S+@(?:v\d+|main|master)\b/);
3232
});
3333

34+
test("PR checks reach every branch the target gate accepts", async () => {
35+
// These two lists have to move together with enforce-pr-target.yml. The
36+
// gate now accepts dev2-go, and a PR that passes the gate but triggers no
37+
// checks is worse than one that is blocked: it looks reviewable and has
38+
// nothing behind it. Pin the pull_request branch lists to the gate's
39+
// allow-list plus main.
40+
const gate = await readText(".github/workflows/enforce-pr-target.yml");
41+
const allowed = gate.match(/const ALLOWED_BASES = \[([^\]]*)\];/);
42+
expect(allowed).not.toBeNull();
43+
const bases = [...(allowed?.[1] ?? "").matchAll(/"([^"]+)"/g)].map(m => m[1]);
44+
expect(bases).toEqual(["dev", "dev2-go"]);
45+
46+
for (const path of [".github/workflows/ci.yml", ".github/workflows/service-lifecycle.yml"]) {
47+
const workflow = Bun.YAML.parse(await readText(path)) as {
48+
on?: { pull_request?: { branches?: string[] } };
49+
};
50+
const branches = workflow.on?.pull_request?.branches ?? [];
51+
expect([...branches].sort()).toEqual(["dev", "dev2-go", "main"]);
52+
}
53+
54+
// The push trigger is deliberately narrower: dev2-go is an integration
55+
// line, not a release-promotion source, and release.yml gates on main and
56+
// preview. Widening this one would put dev2-go into that path.
57+
const ci = Bun.YAML.parse(await readText(".github/workflows/ci.yml")) as {
58+
on?: { push?: { branches?: string[] } };
59+
};
60+
expect([...(ci.on?.push?.branches ?? [])].sort()).toEqual(["dev", "main", "preview"]);
61+
});
62+
3463
test("cross-platform CI keeps the GUI lint and build gates", async () => {
3564
// Review finding (PR #97): the GUI build gate was silently dropped once; assert the
3665
// enhanced gate (PR #99) stays wired so broken GUI builds cannot merge unnoticed.

0 commit comments

Comments
 (0)