fix(ci): do not skip Frontend checks on isolation label events

This commit is contained in:
Adam Moussa 2026-09-10 20:23:36 -04:00
parent fc54afd421
commit f366d449c8
No known key found for this signature in database
4 changed files with 16 additions and 22 deletions

View file

@ -4,9 +4,9 @@ on:
pull_request: pull_request:
branches: [main, dev, staging] branches: [main, dev, staging]
# labeled/unlabeled re-evaluate terraform-isolation when the override # labeled/unlabeled re-evaluate terraform-isolation when the override
# label is added or removed. Without them a mixed PR can keep a stale # label is added or removed. Every Frontend checks job runs on those
# green isolation check after the label is taken off. Other jobs skip # events. Skipping the suite would report required checks as success
# on those events so a label change does not re-run the suite. # and could merge a failing SHA.
types: types:
- opened - opened
- synchronize - synchronize
@ -23,15 +23,12 @@ permissions:
jobs: jobs:
build-and-test: build-and-test:
name: Build and test name: Build and test
# Skipped jobs satisfy the required checks on the unchanged SHA.
if: github.event_name != 'pull_request' || (github.event.action != 'labeled' && github.event.action != 'unlabeled')
# Org reusable workflow (Node 24): format check, lint, build, unit tests. # Org reusable workflow (Node 24): format check, lint, build, unit tests.
uses: Sea-Haven-Industries/.github/.github/workflows/ci-typescript-frontend.yaml@af0f002e14a08cdbfd879c1183bfe7eb2604bce9 # v1.0.8 uses: Sea-Haven-Industries/.github/.github/workflows/ci-typescript-frontend.yaml@af0f002e14a08cdbfd879c1183bfe7eb2604bce9 # v1.0.8
with: with:
node-version: "24" node-version: "24"
governance: governance:
if: github.event_name != 'pull_request' || (github.event.action != 'labeled' && github.event.action != 'unlabeled')
# Repo-owned guarantee that every frontend quality gate runs from this # Repo-owned guarantee that every frontend quality gate runs from this
# repository, independent of (and in addition to) the reusable workflow. # repository, independent of (and in addition to) the reusable workflow.
# `npm run verify` is the single command that chains: format check, lint # `npm run verify` is the single command that chains: format check, lint
@ -111,7 +108,6 @@ jobs:
visual-regression: visual-regression:
name: Visual regression name: Visual regression
if: github.event_name != 'pull_request' || (github.event.action != 'labeled' && github.event.action != 'unlabeled')
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.61.1-noble container: mcr.microsoft.com/playwright:v1.61.1-noble
steps: steps:

View file

@ -53,8 +53,9 @@ and synthesis. A task is not done until this is green.
`terraform-isolation-override` label is the only way to merge a mixed `terraform-isolation-override` label is the only way to merge a mixed
Terraform/application PR. `ci.yaml` runs `terraform-isolation` on Terraform/application PR. `ci.yaml` runs `terraform-isolation` on
`labeled` and `unlabeled` as well as the default pull-request types, so `labeled` and `unlabeled` as well as the default pull-request types, so
adding or removing the label re-checks the current labels. The other CI adding or removing the label re-checks the current labels. The other
jobs skip on those events. Removing the label fails a mixed PR that had Frontend checks jobs run on those events too; skipping them would report
required checks as success. Removing the label fails a mixed PR that had
previously passed with the override. previously passed with the override.
## Where the gates run ## Where the gates run

View file

@ -147,7 +147,7 @@ test("CLI refuses to run without a base ref or --stdin", () => {
assert.notEqual(result.status, 0); assert.notEqual(result.status, 0);
}); });
test("ci.yaml re-evaluates isolation on labeled and unlabeled and skips other jobs", () => { test("ci.yaml re-evaluates isolation on labeled and unlabeled without skipping other jobs", () => {
const yaml = readFileSync( const yaml = readFileSync(
path.join(path.dirname(fileURLToPath(import.meta.url)), "..", ".github/workflows/ci.yaml"), path.join(path.dirname(fileURLToPath(import.meta.url)), "..", ".github/workflows/ci.yaml"),
"utf8", "utf8",
@ -156,15 +156,13 @@ test("ci.yaml re-evaluates isolation on labeled and unlabeled and skips other jo
assert.match(yaml, new RegExp(`^ - ${eventType}$`, "m"), eventType); assert.match(yaml, new RegExp(`^ - ${eventType}$`, "m"), eventType);
} }
const skipLabelEvents = assert.match(yaml, /^ terraform-isolation:\n/m);
/^ if: github\.event_name != 'pull_request' \|\| \(github\.event\.action != 'labeled' && github\.event\.action != 'unlabeled'\)$/gm; assert.doesNotMatch(
assert.equal( yaml,
[...yaml.matchAll(skipLabelEvents)].length, /github\.event\.action != 'labeled'/,
3, "skipping other jobs on label events would report required checks as success",
"build-and-test, governance, and visual-regression skip label events",
); );
const isolation = yaml.split(/^ terraform-isolation:\n/m)[1]?.split(/^ [a-z]/m)[0] ?? ""; const isolation = yaml.split(/^ terraform-isolation:\n/m)[1]?.split(/^ [a-z]/m)[0] ?? "";
assert.match(isolation, /if: github\.event_name == 'pull_request'/); assert.match(isolation, /if: github\.event_name == 'pull_request'/);
assert.doesNotMatch(isolation, /if: github\.event\.action != 'labeled'/);
}); });

View file

@ -222,11 +222,10 @@ the labels. Push-to-`dev` releases return behind the repository variable
`scripts/*terraform*` tooling are allowed alongside. A reviewer may add the `scripts/*terraform*` tooling are allowed alongside. A reviewer may add the
`terraform-isolation-override` label for the rare change that must introduce `terraform-isolation-override` label for the rare change that must introduce
Terraform variables together with the workflow that consumes them (PR C). Terraform variables together with the workflow that consumes them (PR C).
Adding or removing that label re-runs `terraform-isolation` against the Adding or removing that label re-runs the Frontend checks workflow,
labels currently on the PR; the other CI jobs skip on those events so a including `terraform-isolation`, against the labels currently on the PR.
label change does not re-run the suite. Removing the label fails a mixed Removing the label fails a mixed PR that had previously passed with the
PR that had previously passed with the override, so a stale green check override, so a stale green check cannot merge. Markdown under `terraform/` does not count as a Terraform
cannot merge. Markdown under `terraform/` does not count as a Terraform
change for this gate; it does not match the workspace trigger patterns. change for this gate; it does not match the workspace trigger patterns.
The label is the approval record. The override is temporary: The label is the approval record. The override is temporary:
a follow-up PR after PR C removes the label path from the checker and a follow-up PR after PR C removes the label path from the checker and