Skip to content

Commit 38e46fd

Browse files
committed
ci: make Verify Examples self-verifying and gate on every check
Three fixes from the third review on #844. Trigger Verify Examples on its own machinery. The workflow only ran for examples/**, so a pull request changing example-matrix.json or select-examples.sh — now the single source of truth for what gets verified — never ran it. This pull request is the proof: it rewires all three matrices and its checks are Commit Lint, CodeQL and pr.yaml only, no validate or test-* at all. The matrix file, the selector directory and this workflow are now triggers, so it verifies its own changes. src/, layer/ and Cargo.* are deliberately still not pull request triggers even though the selector treats them as shared: adding them would run all eighteen matrix entries on every source pull request. Adapter changes stay verified against the examples on push to main, and the shared-path rule still applies to a pull request touching both. Gate on the whole check rollup, not just this one run. Commit Lint runs on every pull request with no path filter and does go red on Dependabot PRs (#799), yet the merge consulted only the Verify Examples run, and any check added later would have been ignored too. Anything not SUCCESS/SKIPPED/NEUTRAL — including still running, since a workflow_run job cannot wait — now refuses the merge; Dependabot rebases these branches often and any later run re-evaluates. Verified against live data: the query is empty for #842 (all green, CodeQL NEUTRAL) and names the failure on #844. This workflow's own run is excluded defensively, since an in-progress self-check would deadlock every merge if workflow_run runs ever joined the rollup. Add the github-actions ecosystem for the commit prefix, for the same reason bundler was added: every workflow pins actions, so an advisory would open a PR with no conventional type and a red Commit Lint. With the limit at 0 it adds no pull requests. Pre-emptive — there are no open actions alerts today (the 705 open alerts are npm, pip, go, rubygems, rust and maven).
1 parent 33c1cb3 commit 38e46fd

3 files changed

Lines changed: 55 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,23 @@ updates:
124124
applies-to: security-updates
125125
patterns:
126126
- "*"
127+
128+
# Not an example, and listed for the naming alone. Every workflow here pins actions
129+
# (actions/checkout@v4, Swatinem/rust-cache@v2, orhun/git-cliff-action@v4), so an
130+
# actions advisory would open a PR titled "bump actions/... from X to Y" — no
131+
# conventional type, red Commit Lint, manual amend. With the limit at 0 this adds no
132+
# pull requests; it only names the ones an advisory would produce anyway. There are
133+
# no open actions alerts today, so this is pre-emptive.
134+
- package-ecosystem: github-actions
135+
directories:
136+
- "/"
137+
schedule:
138+
interval: weekly
139+
open-pull-requests-limit: 0
140+
commit-message:
141+
prefix: ci
142+
groups:
143+
github-actions:
144+
applies-to: security-updates
145+
patterns:
146+
- "*"

.github/workflows/dependabot-automerge.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,28 @@ jobs:
103103
exit 0
104104
fi
105105
106+
# Verify Examples is not the only check on the pull request. Commit Lint runs
107+
# on every pull request with no path filter and does go red on Dependabot
108+
# PRs (#799), and any check added later would be ignored here too. Anything
109+
# not green — including still running, since this workflow cannot wait — means
110+
# leave it alone; Dependabot rebases these branches often, and any later
111+
# Verify Examples run re-evaluates the pull request.
112+
#
113+
# This workflow's own run is excluded defensively. workflow_run runs do not
114+
# currently appear in a pull request's check rollup, but if that changed, its
115+
# in-progress state would deadlock every merge.
116+
not_green=$(gh pr view "$PR_NUMBER" --repo "$REPO" --json statusCheckRollup -q '
117+
.statusCheckRollup[]
118+
| select((.workflowName // "") != "Dependabot Auto-merge")
119+
| select([((.conclusion // .state // "PENDING") | ascii_upcase)]
120+
- ["SUCCESS", "SKIPPED", "NEUTRAL"] | length > 0)
121+
| ((.name // .context) + " = " + (.conclusion // .state // "PENDING"))')
122+
if [[ -n "$not_green" ]]; then
123+
echo "PR #$PR_NUMBER has checks that are not green; refusing to merge:"
124+
echo "$not_green" | sed 's/^/ /'
125+
exit 0
126+
fi
127+
106128
# Covered examples are only actually verified if their jobs ran. Count lines
107129
# rather than asking jq for a length: --paginate applies -q per page, so a
108130
# run spanning two pages would yield one count per line ("18\n4"), and

.github/workflows/examples.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@ on:
66
- main
77
paths:
88
- "examples/**"
9+
# This workflow's own machinery. The matrix file and the selector decide what
10+
# gets verified at all, so a pull request that changes only those would
11+
# otherwise not run here — and a malformed matrix or a selector regression
12+
# would land unverified and surface later on an unrelated examples pull
13+
# request. Including them makes the workflow verify its own changes.
14+
- ".github/workflows/examples.yaml"
15+
- ".github/scripts/**"
16+
- ".github/example-matrix.json"
917
push:
1018
branches:
1119
- main
1220
paths:
1321
- "src/**"
22+
# Note that src/, layer/ and Cargo.* are deliberately NOT pull request triggers,
23+
# even though select-examples.sh treats them as shared: adding them would run all
24+
# eighteen matrix entries on every source pull request. Adapter changes are verified
25+
# against the examples on push to main (above), and the selector's shared-path rule
26+
# still applies to a pull request that touches both source and examples.
1427
workflow_dispatch:
1528

1629
permissions:

0 commit comments

Comments
 (0)