|
50 | 50 | BASE: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} |
51 | 51 | run: bun scripts/verify.ts full --step "${{ matrix.step }}" |
52 | 52 |
|
53 | | - policy-surface: |
54 | | - name: Policy surface |
55 | | - runs-on: ubuntu-latest |
56 | | - steps: |
57 | | - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 |
58 | | - with: |
59 | | - fetch-depth: 0 |
60 | | - - name: Require [policy] marker when control files change |
61 | | - env: |
62 | | - BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} |
63 | | - HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} |
64 | | - run: | |
65 | | - set -euo pipefail |
66 | | -
|
67 | | - # The control plane: deterministic gates and the rules that govern them. |
68 | | - # Editing any of these changes what every other check enforces, so the |
69 | | - # change must be explicit — a [policy] marker in the commit range. |
70 | | - patterns=' |
71 | | - .dependency-cruiser.cjs |
72 | | - sgconfig.yml |
73 | | - biome.json |
74 | | - tools/architecture/ |
75 | | - .githooks/ |
76 | | - .claude/hooks/ |
77 | | - .github/workflows/ |
78 | | - scripts/lint-changed.sh |
79 | | - scripts/verify.ts |
80 | | - scripts/verify.test.ts |
81 | | - scripts/pr-evidence.ts |
82 | | - scripts/pr-evidence.test.ts |
83 | | - scripts/release/ |
84 | | - scripts/setup-githooks.sh |
85 | | - ' |
86 | | -
|
87 | | - base="$BASE_SHA" |
88 | | - # New branch / first push: no usable base; nothing to diff against. |
89 | | - if [ -z "$base" ] || ! git cat-file -e "$base^{commit}" 2>/dev/null; then |
90 | | - echo "No base commit to compare against; skipping policy-surface check." |
91 | | - exit 0 |
92 | | - fi |
93 | | -
|
94 | | - changed=$(git diff --name-only "$base" "$HEAD_SHA") |
95 | | - touched="" |
96 | | - for p in $patterns; do |
97 | | - hit=$(printf '%s\n' "$changed" | grep -F "$p" || true) |
98 | | - if [ -n "$hit" ]; then |
99 | | - touched="$touched$hit"$'\n' |
100 | | - fi |
101 | | - done |
102 | | -
|
103 | | - if [ -z "$touched" ]; then |
104 | | - echo "No control-plane files changed." |
105 | | - exit 0 |
106 | | - fi |
107 | | -
|
108 | | - echo "Control-plane files changed:" |
109 | | - printf '%s' "$touched" | sed 's/^/ - /' |
110 | | -
|
111 | | - if git log "$base..$HEAD_SHA" --format=%B | grep -qF '[policy]'; then |
112 | | - echo "Found [policy] marker in commit range. OK." |
113 | | - exit 0 |
114 | | - fi |
115 | | -
|
116 | | - echo "::error::Control-plane files changed without a [policy] marker in any commit message." |
117 | | - echo "Add '[policy]' to a commit message to acknowledge changing the verification harness itself." |
118 | | - exit 1 |
119 | | -
|
120 | 53 | maintainer-evidence: |
121 | 54 | name: Maintainer evidence |
122 | 55 | runs-on: ubuntu-latest |
@@ -157,14 +90,13 @@ jobs: |
157 | 90 | gate: |
158 | 91 | name: Gate |
159 | 92 | runs-on: ubuntu-latest |
160 | | - needs: [prepare-verification, verify, policy-surface, maintainer-evidence, package-compatibility] |
| 93 | + needs: [prepare-verification, verify, maintainer-evidence, package-compatibility] |
161 | 94 | if: always() |
162 | 95 | steps: |
163 | 96 | - name: Check results |
164 | 97 | run: | |
165 | 98 | if [ "${{ needs.prepare-verification.result }}" != "success" ] || \ |
166 | 99 | [ "${{ needs.verify.result }}" != "success" ] || \ |
167 | | - [ "${{ needs.policy-surface.result }}" != "success" ] || \ |
168 | 100 | [ "${{ needs.maintainer-evidence.result }}" != "success" ] || \ |
169 | 101 | [ "${{ needs.package-compatibility.result }}" != "success" ]; then |
170 | 102 | echo "One or more required checks failed." |
|
0 commit comments