checkwright 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/payload/gate-sdk/README.md +1 -0
- package/payload/gate-sdk/SPEC.md +288 -13
- package/payload/gate-sdk/bin/upgrade-smoke.sh +35 -15
- package/payload/gate-sdk/checks/check-action-gh-repo.sh +321 -0
- package/payload/gate-sdk/gate-tests/check-action-gh-repo/bad/args +3 -0
- package/payload/gate-sdk/gate-tests/check-action-gh-repo/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-gh-repo/bad/tree/workflows/publish.yml +78 -0
- package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/args +4 -0
- package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/tree/action.yml +11 -0
- package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/tree/not-actions.yml +10 -0
- package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/tree/workflows/arms.yml +93 -0
- package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/tree/workflows/root-env.yml +18 -0
- package/payload/gate-sdk/gate-tests/check-action-gh-repo/good/tree/workflows/valves.yml +39 -0
- package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +112 -0
- package/payload/gate-sdk/lib/declaration.sh +59 -0
- package/payload/lifecycle-kit/templates/stages/build.md +15 -0
- package/payload/site-kit/README.md +12 -5
- package/payload/site-kit/SPEC.md +183 -19
- package/payload/site-kit/templates/site-health.yml +128 -6
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# graph: couples=.github/workflows/*.yml,.github/workflows/*.yaml,.github/ISSUE_TEMPLATE/*.yml,docs/_config.yml,kit:templates/*.yml,kit:templates/*.yaml dir=one valve=none tier=precommit
|
|
3
|
+
# spec: gate-sdk/SPEC.md §check-action-gh-repo — a job whose run: bodies invoke gh establishes a repository context: a checkout before the first call, GH_REPO in scope, or --repo on every call
|
|
4
|
+
#
|
|
5
|
+
# usage: check-action-gh-repo.sh [scan-root]
|
|
6
|
+
# scan-root: the walked tree (default '.'). Requires GNU awk (3-arg match).
|
|
7
|
+
set -uo pipefail
|
|
8
|
+
|
|
9
|
+
SDK="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
10
|
+
# shellcheck source=../lib/gate.sh
|
|
11
|
+
source "$SDK/lib/gate.sh"
|
|
12
|
+
|
|
13
|
+
SCANROOT="${1:-.}"
|
|
14
|
+
[[ -d "$SCANROOT" ]] || { echo "check-action-gh-repo: scan root not found: $SCANROOT" >&2; exit 2; }
|
|
15
|
+
|
|
16
|
+
listing="$(gate_find "$SCANROOT" -type f \( -name '*.yml' -o -name '*.yaml' \))"; st=$?
|
|
17
|
+
fail_closed "$st" ACTION-GH-REPO gate_find
|
|
18
|
+
mapfile -t files < <(printf '%s' "$listing")
|
|
19
|
+
|
|
20
|
+
if [[ ${#files[@]} -eq 0 ]]; then
|
|
21
|
+
echo "ACTION-GH-REPO: clean (no YAML under $SCANROOT — 0 job(s) to check)"
|
|
22
|
+
exit 0
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
WALK='
|
|
26
|
+
function ind(s, n) { n = match(s, /[^ ]/); return (n == 0) ? -1 : n - 1 }
|
|
27
|
+
|
|
28
|
+
function keyof(s, t) {
|
|
29
|
+
t = s
|
|
30
|
+
sub(/^[ ]*/, "", t)
|
|
31
|
+
if (t !~ /^[^ :]+[ ]*:/) return ""
|
|
32
|
+
sub(/[ ]*:.*$/, "", t)
|
|
33
|
+
return t
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# spec: gate-sdk/SPEC.md §check-action-gh-repo — the trigger and the --repo arm share one detector, so the arm is universally quantified over the detected set rather than satisfied by a witness
|
|
37
|
+
function scanlogical(s, ln, t, n, i, c, prefix, w, ok, ext, j, cut, hasrepo) {
|
|
38
|
+
t = s
|
|
39
|
+
sub(/^[ \t]+/, "", t)
|
|
40
|
+
if (substr(t, 1, 1) == "#") return
|
|
41
|
+
n = length(s)
|
|
42
|
+
for (i = 1; i < n; i++) {
|
|
43
|
+
if (substr(s, i, 2) != "gh") continue
|
|
44
|
+
c = substr(s, i + 2, 1)
|
|
45
|
+
if (c ~ /[A-Za-z0-9_.-]/) continue
|
|
46
|
+
prefix = substr(s, 1, i - 1)
|
|
47
|
+
sub(/[ \t]+$/, "", prefix)
|
|
48
|
+
ok = 0
|
|
49
|
+
if (prefix == "") ok = 1
|
|
50
|
+
else {
|
|
51
|
+
c = substr(prefix, length(prefix))
|
|
52
|
+
if (index("|&;(`!{", c) > 0) ok = 1
|
|
53
|
+
else {
|
|
54
|
+
w = prefix
|
|
55
|
+
sub(/^.*[ \t]/, "", w)
|
|
56
|
+
if (w == "then" || w == "else" || w == "do" || w == "elif") ok = 1
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (!ok) continue
|
|
60
|
+
ext = substr(s, i + 2)
|
|
61
|
+
cut = length(ext)
|
|
62
|
+
for (j = 1; j <= length(ext); j++) {
|
|
63
|
+
c = substr(ext, j, 1)
|
|
64
|
+
if (c == ";" || c == "|" || c == "&") { cut = j - 1; break }
|
|
65
|
+
}
|
|
66
|
+
ext = substr(ext, 1, cut)
|
|
67
|
+
hasrepo = (ext ~ /(^|[ \t])--repo([ \t=]|$)/) ? 1 : 0
|
|
68
|
+
printf "G\t%d\t%d\n", ln, hasrepo
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# spec: gate-sdk/SPEC.md §check-action-gh-repo — backslash continuations are joined before matching, so a call split across lines is one unit and its --repo is found wherever on the call it sits
|
|
73
|
+
function endrun( i, s, acc, accln) {
|
|
74
|
+
inrun = 0
|
|
75
|
+
acc = ""; accln = 0
|
|
76
|
+
for (i = 0; i < rn; i++) {
|
|
77
|
+
s = rbuf[i]
|
|
78
|
+
if (acc == "") accln = rln[i]
|
|
79
|
+
if (s ~ /\\$/) { sub(/\\$/, "", s); acc = acc s " "; continue }
|
|
80
|
+
scanlogical(acc s, accln)
|
|
81
|
+
acc = ""
|
|
82
|
+
}
|
|
83
|
+
if (acc != "") scanlogical(acc, accln)
|
|
84
|
+
rn = 0
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
# spec: gate-sdk/SPEC.md §check-action-gh-repo — the marker binds by its own indentation: at or left of the job-id column it precedes a job, at the step dash column it precedes a step, inside a step it binds that step
|
|
88
|
+
function marker(line, ln, c, r) {
|
|
89
|
+
if (line !~ /gh-repo-exempt/) return
|
|
90
|
+
r = ""
|
|
91
|
+
if (line ~ /gh-repo-exempt[ \t]*:/) {
|
|
92
|
+
r = line
|
|
93
|
+
sub(/^.*gh-repo-exempt[ \t]*:[ \t]*/, "", r)
|
|
94
|
+
sub(/[ \t]+$/, "", r)
|
|
95
|
+
}
|
|
96
|
+
if (r == "") { printf "XBAD\t%d\n", ln; return }
|
|
97
|
+
if (!injobs) return
|
|
98
|
+
c = ind(line)
|
|
99
|
+
if (jobcol >= 0 && c <= jobcol) { pendjob = r; return }
|
|
100
|
+
if (curjob == "") { pendjob = r; return }
|
|
101
|
+
if (insteps) {
|
|
102
|
+
if (stepdashcol < 0 || c <= stepdashcol) { pendstep = r; return }
|
|
103
|
+
if (stepcol >= 0) { printf "SX\t%s\n", r; return }
|
|
104
|
+
pendstep = r
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
printf "JX\t%s\n", r
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function stepkey(rest, col, ln, k, v, u) {
|
|
111
|
+
k = keyof(rest)
|
|
112
|
+
if (k == "") return
|
|
113
|
+
v = rest
|
|
114
|
+
sub(/^[^:]*:[ \t]*/, "", v)
|
|
115
|
+
sub(/[ \t]+$/, "", v)
|
|
116
|
+
if (k == "uses") {
|
|
117
|
+
gsub(/^["\047]+|["\047]+$/, "", v)
|
|
118
|
+
sub(/[ \t].*$/, "", v)
|
|
119
|
+
u = v
|
|
120
|
+
sub(/@.*$/, "", u)
|
|
121
|
+
if (u == "actions/checkout") printf "C\t%d\n", ln
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
if (k == "env") { envscope = "step"; envcol = col; return }
|
|
125
|
+
if (k != "run") return
|
|
126
|
+
# spec: gate-sdk/SPEC.md §check-action-gh-repo — a folded body is scanned line-wise like a literal one, and a plain scalar as a single logical line: both over-detect, the stated safe direction
|
|
127
|
+
if (v ~ /^[|>][-+]?[0-9]*$/) { inrun = 1; runkeycol = col; rbi = -1; rn = 0; return }
|
|
128
|
+
if (v != "") scanlogical(v, ln)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
BEGIN { jobcol = -1; jobkeycol = -1; stepcol = -1; stepdashcol = -1; envscope = ""; curjob = ""; pendjob = ""; pendstep = ""; inrun = 0; injobs = 0; insteps = 0 }
|
|
132
|
+
|
|
133
|
+
{
|
|
134
|
+
line = $0
|
|
135
|
+
sub(/\r$/, "", line)
|
|
136
|
+
|
|
137
|
+
if (inrun) {
|
|
138
|
+
if (line ~ /^[ \t]*$/) { rbuf[rn] = ""; rln[rn] = FNR; rn++; next }
|
|
139
|
+
c = ind(line)
|
|
140
|
+
if (c > runkeycol) {
|
|
141
|
+
if (rbi < 0) rbi = c
|
|
142
|
+
rbuf[rn] = substr(line, rbi + 1); rln[rn] = FNR; rn++
|
|
143
|
+
next
|
|
144
|
+
}
|
|
145
|
+
endrun()
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (line ~ /^[ \t]*$/) next
|
|
149
|
+
if (line ~ /^[ ]*#/) { marker(line, FNR); next }
|
|
150
|
+
|
|
151
|
+
c = ind(line)
|
|
152
|
+
|
|
153
|
+
if (envscope != "") {
|
|
154
|
+
if (c > envcol) {
|
|
155
|
+
if (line ~ /^[ ]*GH_REPO[ ]*:/) print (envscope == "workflow" ? "W" : (envscope == "job" ? "JE" : "SE"))
|
|
156
|
+
next
|
|
157
|
+
}
|
|
158
|
+
envscope = ""
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (c == 0) {
|
|
162
|
+
topkey = keyof(line)
|
|
163
|
+
injobs = (topkey == "jobs")
|
|
164
|
+
curjob = ""; stepcol = -1; insteps = 0
|
|
165
|
+
if (topkey == "env") { envscope = "workflow"; envcol = 0 }
|
|
166
|
+
next
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (!injobs) next
|
|
170
|
+
if (jobcol < 0) jobcol = c
|
|
171
|
+
|
|
172
|
+
if (c == jobcol) {
|
|
173
|
+
curjob = keyof(line)
|
|
174
|
+
if (curjob == "") next
|
|
175
|
+
printf "J\t%s\t%d\n", curjob, FNR
|
|
176
|
+
if (pendjob != "") { printf "JX\t%s\n", pendjob }
|
|
177
|
+
pendjob = ""; pendstep = ""
|
|
178
|
+
jobkeycol = -1; stepcol = -1; stepdashcol = -1; insteps = 0
|
|
179
|
+
next
|
|
180
|
+
}
|
|
181
|
+
if (curjob == "") next
|
|
182
|
+
if (jobkeycol < 0) jobkeycol = c
|
|
183
|
+
|
|
184
|
+
if (c == jobkeycol) {
|
|
185
|
+
stepcol = -1
|
|
186
|
+
k = keyof(line)
|
|
187
|
+
insteps = (k == "steps")
|
|
188
|
+
if (k == "env") { envscope = "job"; envcol = c }
|
|
189
|
+
next
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (!insteps) next
|
|
193
|
+
|
|
194
|
+
# spec: gate-sdk/SPEC.md §check-action-gh-repo — a new step is a dash at the step-list column alone, so a nested list under with:/strategy: is not read as a step
|
|
195
|
+
if (match(line, /^[ ]*-[ ]+/)) {
|
|
196
|
+
if (stepdashcol < 0) stepdashcol = c
|
|
197
|
+
if (c == stepdashcol) {
|
|
198
|
+
stepcol = RLENGTH
|
|
199
|
+
printf "S\t%d\n", FNR
|
|
200
|
+
if (pendstep != "") { printf "SX\t%s\n", pendstep }
|
|
201
|
+
pendstep = ""
|
|
202
|
+
stepkey(substr(line, stepcol + 1), stepcol, FNR)
|
|
203
|
+
next
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (stepcol >= 0 && c == stepcol) stepkey(substr(line, c + 1), c, FNR)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
END { if (inrun) endrun() }
|
|
210
|
+
'
|
|
211
|
+
|
|
212
|
+
walked=0; subject=0; composite=0; outside=0
|
|
213
|
+
armed=0; inert=0; exempt=0; calls=0
|
|
214
|
+
findings=(); bare=()
|
|
215
|
+
|
|
216
|
+
curfile=""; wenv=0
|
|
217
|
+
job=""; jobline=0; jexempt=0; jenv=0
|
|
218
|
+
checkouts=(); iln=(); irepo=(); ienv=()
|
|
219
|
+
senv=0; sexempt=0; sln=(); srepo=()
|
|
220
|
+
have_job=0; have_step=0
|
|
221
|
+
|
|
222
|
+
finish_step() {
|
|
223
|
+
(( have_step )) || return 0
|
|
224
|
+
have_step=0
|
|
225
|
+
local i
|
|
226
|
+
if (( sexempt == 0 && ${#sln[@]} > 0 )); then
|
|
227
|
+
for i in "${!sln[@]}"; do
|
|
228
|
+
iln+=("${sln[$i]}"); irepo+=("${srepo[$i]}")
|
|
229
|
+
if (( wenv || jenv || senv )); then ienv+=(1); else ienv+=(0); fi
|
|
230
|
+
done
|
|
231
|
+
fi
|
|
232
|
+
senv=0; sexempt=0; sln=(); srepo=()
|
|
233
|
+
return 0
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
# spec: gate-sdk/SPEC.md §check-action-gh-repo — the three arms are disjoined per job and each is universally quantified over the job's detected set
|
|
237
|
+
finish_job() {
|
|
238
|
+
(( have_job )) || return 0
|
|
239
|
+
finish_step
|
|
240
|
+
have_job=0
|
|
241
|
+
if (( jexempt )); then exempt=$((exempt + 1)); return 0; fi
|
|
242
|
+
if (( ${#iln[@]} == 0 )); then inert=$((inert + 1)); return 0; fi
|
|
243
|
+
armed=$((armed + 1)); calls=$((calls + ${#iln[@]}))
|
|
244
|
+
local first="${iln[0]}" i allenv=1 allrepo=1
|
|
245
|
+
for i in "${iln[@]}"; do (( i < first )) && first="$i"; done
|
|
246
|
+
if (( ${#checkouts[@]} > 0 )); then
|
|
247
|
+
for i in "${checkouts[@]}"; do (( i < first )) && return 0; done
|
|
248
|
+
fi
|
|
249
|
+
for i in "${ienv[@]}"; do (( i )) || allenv=0; done
|
|
250
|
+
for i in "${irepo[@]}"; do (( i )) || allrepo=0; done
|
|
251
|
+
(( allenv || allrepo )) && return 0
|
|
252
|
+
findings+=("$curfile:$jobline: job '$job' first invokes gh at line $first with no repository context")
|
|
253
|
+
return 0
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
for f in "${files[@]}"; do
|
|
257
|
+
[[ -n "$f" ]] || continue
|
|
258
|
+
walked=$((walked + 1))
|
|
259
|
+
# spec: gate-sdk/SPEC.md §check-action-gh-repo — the Actions-shape predicate is split in two: the gate's unit is a job under jobs:, and a runs:-shaped composite action inherits its caller's repository context
|
|
260
|
+
if grep -qE '^jobs:' "$f"; then
|
|
261
|
+
subject=$((subject + 1))
|
|
262
|
+
elif grep -qE '^runs:' "$f"; then
|
|
263
|
+
composite=$((composite + 1))
|
|
264
|
+
continue
|
|
265
|
+
else
|
|
266
|
+
outside=$((outside + 1))
|
|
267
|
+
continue
|
|
268
|
+
fi
|
|
269
|
+
|
|
270
|
+
stream="$(awk "$WALK" "$f")"; st=$?
|
|
271
|
+
fail_closed "$st" ACTION-GH-REPO "awk walk($f)"
|
|
272
|
+
|
|
273
|
+
curfile="$f"
|
|
274
|
+
wenv=0
|
|
275
|
+
grep -qx 'W' <<< "$stream" && wenv=1
|
|
276
|
+
|
|
277
|
+
while IFS=$'\t' read -r kind a b; do
|
|
278
|
+
case "$kind" in
|
|
279
|
+
J) finish_job
|
|
280
|
+
job="$a"; jobline="$b"; jexempt=0; jenv=0
|
|
281
|
+
checkouts=(); iln=(); irepo=(); ienv=(); have_job=1 ;;
|
|
282
|
+
JE) jenv=1 ;;
|
|
283
|
+
JX) jexempt=1 ;;
|
|
284
|
+
S) finish_step; have_step=1 ;;
|
|
285
|
+
SE) senv=1 ;;
|
|
286
|
+
SX) sexempt=1 ;;
|
|
287
|
+
C) checkouts+=("$a") ;;
|
|
288
|
+
G) sln+=("$a"); srepo+=("$b"); have_step=1 ;;
|
|
289
|
+
XBAD) bare+=("$f:$a: a gh-repo-exempt marker with no reason") ;;
|
|
290
|
+
esac
|
|
291
|
+
done <<< "$stream"
|
|
292
|
+
finish_job
|
|
293
|
+
done
|
|
294
|
+
|
|
295
|
+
red=0
|
|
296
|
+
|
|
297
|
+
if [[ ${#findings[@]} -gt 0 ]]; then
|
|
298
|
+
red=1
|
|
299
|
+
echo "check-action-gh-repo: a job invokes gh with no way to resolve a target"
|
|
300
|
+
echo "repository, so every call in it dies before its first request — on a tag,"
|
|
301
|
+
echo "where nothing else in the battery runs:"
|
|
302
|
+
printf ' %s\n' "${findings[@]}"
|
|
303
|
+
echo " help: add an actions/checkout step before the first gh call, or set"
|
|
304
|
+
echo " GH_REPO: \${{ github.repository }} on the workflow, the job, or the"
|
|
305
|
+
echo " invoking step's env:, or pass --repo on every gh call in the job."
|
|
306
|
+
echo " A job standing outside all three takes '# gh-repo-exempt: <reason>'."
|
|
307
|
+
fi
|
|
308
|
+
|
|
309
|
+
if [[ ${#bare[@]} -gt 0 ]]; then
|
|
310
|
+
red=1
|
|
311
|
+
echo "check-action-gh-repo: a gh-repo-exempt marker carries no reason, so it records"
|
|
312
|
+
echo "that an arm was stood outside of without saying which one or why:"
|
|
313
|
+
printf ' %s\n' "${bare[@]}"
|
|
314
|
+
echo " help: write the marker as '# gh-repo-exempt: <reason>' naming the arm the"
|
|
315
|
+
echo " job stands outside of, or delete it and satisfy an arm."
|
|
316
|
+
fi
|
|
317
|
+
|
|
318
|
+
[[ "$red" -eq 1 ]] && exit 1
|
|
319
|
+
|
|
320
|
+
echo "ACTION-GH-REPO: clean ($armed job(s) invoking gh across $subject Actions-shaped file(s) of $walked walked, all resolving a repository; $calls invocation(s) detected, $inert job(s) invoking none, $exempt exempt, $composite composite-action file(s) and $outside non-Actions file(s) skipped)"
|
|
321
|
+
exit 0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
job 'release' first invokes gh at line 35 with no repository context
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: reject-cases
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v[0-9]*'
|
|
7
|
+
|
|
8
|
+
permissions: {}
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
# The attested miss, reproduced as it shipped: this job took down v0.17.0's
|
|
12
|
+
# release on its first live run, dying in seconds on "failed to run git: fatal:
|
|
13
|
+
# not a git repository" before its first API call — no Release created, no
|
|
14
|
+
# assets attached. It checks nothing out, sets GH_TOKEN and TAG but no GH_REPO,
|
|
15
|
+
# and passes no --repo, so gh has nothing to resolve a target repository from.
|
|
16
|
+
release:
|
|
17
|
+
needs: pack
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
permissions:
|
|
20
|
+
contents: write
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
23
|
+
with:
|
|
24
|
+
name: installer-package
|
|
25
|
+
path: dist
|
|
26
|
+
|
|
27
|
+
- name: attach the tarball and its checksum to the Release
|
|
28
|
+
env:
|
|
29
|
+
GH_TOKEN: ${{ github.token }}
|
|
30
|
+
TAG: ${{ github.ref_name }}
|
|
31
|
+
run: |
|
|
32
|
+
set -euo pipefail
|
|
33
|
+
name="$(basename dist/*.tgz)"
|
|
34
|
+
( cd dist && sha256sum "$name" > "$name.sha256" )
|
|
35
|
+
if ! gh release view "$TAG" >/dev/null 2>&1; then
|
|
36
|
+
gh release create "$TAG" --title "$TAG" --notes ""
|
|
37
|
+
fi
|
|
38
|
+
gh release upload "$TAG" "dist/$name" "dist/$name.sha256" --clobber
|
|
39
|
+
|
|
40
|
+
# The mixed-call case the arm is designed against. One call carries --repo and
|
|
41
|
+
# the next does not, so a witness-seeking arm would pass this job; the arm is
|
|
42
|
+
# universally quantified over the detected set, so the unprefixed call fails it.
|
|
43
|
+
mixed:
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
steps:
|
|
46
|
+
- name: two calls, one prefixed
|
|
47
|
+
env:
|
|
48
|
+
GH_TOKEN: ${{ github.token }}
|
|
49
|
+
run: |
|
|
50
|
+
set -euo pipefail
|
|
51
|
+
gh release view v1.0.0 --repo owner/repo
|
|
52
|
+
gh release upload v1.0.0 dist/asset.tgz
|
|
53
|
+
|
|
54
|
+
# A checkout establishes a git remote only for the calls that follow it.
|
|
55
|
+
# Ordered after the first call it establishes nothing, and the ordering
|
|
56
|
+
# comparison is free once both line numbers are in hand.
|
|
57
|
+
late_checkout:
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
steps:
|
|
60
|
+
- name: call before the checkout
|
|
61
|
+
env:
|
|
62
|
+
GH_TOKEN: ${{ github.token }}
|
|
63
|
+
run: |
|
|
64
|
+
gh issue list --state open
|
|
65
|
+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
|
|
66
|
+
|
|
67
|
+
# A bare marker is its own failure class with its own help: line. The valve's
|
|
68
|
+
# whole value is the sentence saying which arm the author stands outside of, so
|
|
69
|
+
# a marker with no reason exempts nothing and reds on the marker itself.
|
|
70
|
+
bare_valve:
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
# gh-repo-exempt:
|
|
73
|
+
steps:
|
|
74
|
+
- name: an unexplained exemption
|
|
75
|
+
env:
|
|
76
|
+
GH_TOKEN: ${{ github.token }}
|
|
77
|
+
run: |
|
|
78
|
+
gh issue list --state open
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ACTION-GH-REPO: clean (6 job(s) invoking gh across 3 Actions-shaped file(s) of 5 walked, all resolving a repository; 11 invocation(s) detected, 1 job(s) invoking none, 1 exempt, 1 composite-action file(s) and 1 non-Actions file(s) skipped)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# A composite action carries no job of its own and inherits the calling job's
|
|
2
|
+
# repository context, so the assertion belongs to the caller. Skipped and counted.
|
|
3
|
+
name: composite
|
|
4
|
+
description: a runs:-shaped file with a gh call and no jobs: key
|
|
5
|
+
|
|
6
|
+
runs:
|
|
7
|
+
using: composite
|
|
8
|
+
steps:
|
|
9
|
+
- shell: bash
|
|
10
|
+
run: |
|
|
11
|
+
gh issue list --state open
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Another CI schema spelling a shell step run:. It carries neither a top-level
|
|
2
|
+
# jobs: nor a top-level runs: key, so it is outside the scan entirely — gate-sdk
|
|
3
|
+
# ships no template for it and owns no contract over it.
|
|
4
|
+
version: 2
|
|
5
|
+
|
|
6
|
+
workflows:
|
|
7
|
+
build:
|
|
8
|
+
steps:
|
|
9
|
+
- run: |
|
|
10
|
+
gh release create v1.0.0
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
name: accept-cases
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v[0-9]*'
|
|
7
|
+
|
|
8
|
+
permissions: {}
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
# The env arm on its narrowest sub-arm. The attested miss's repair sets GH_REPO
|
|
12
|
+
# on the invoking step, not at workflow or job root, so a gate implementing only
|
|
13
|
+
# the two outer lookups would red the one job it exists for.
|
|
14
|
+
step_env:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
20
|
+
with:
|
|
21
|
+
name: installer-package
|
|
22
|
+
path: dist
|
|
23
|
+
|
|
24
|
+
- name: attach the tarball to the Release
|
|
25
|
+
env:
|
|
26
|
+
GH_TOKEN: ${{ github.token }}
|
|
27
|
+
GH_REPO: ${{ github.repository }}
|
|
28
|
+
TAG: ${{ github.ref_name }}
|
|
29
|
+
run: |
|
|
30
|
+
set -euo pipefail
|
|
31
|
+
if ! gh release view "$TAG" >/dev/null 2>&1; then
|
|
32
|
+
gh release create "$TAG" --title "$TAG" --notes ""
|
|
33
|
+
fi
|
|
34
|
+
gh release upload "$TAG" dist/asset.tgz --clobber
|
|
35
|
+
|
|
36
|
+
job_env:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
env:
|
|
39
|
+
GH_REPO: ${{ github.repository }}
|
|
40
|
+
steps:
|
|
41
|
+
- name: the job-level lookup
|
|
42
|
+
env:
|
|
43
|
+
GH_TOKEN: ${{ github.token }}
|
|
44
|
+
run: |
|
|
45
|
+
gh issue list --state open
|
|
46
|
+
|
|
47
|
+
# The checkout arm: the uses: ref before the @ is actions/checkout and its line
|
|
48
|
+
# precedes the job's first detected invocation.
|
|
49
|
+
checkout_arm:
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
|
|
53
|
+
- name: a call the checkout above establishes a remote for
|
|
54
|
+
env:
|
|
55
|
+
GH_TOKEN: ${{ github.token }}
|
|
56
|
+
run: |
|
|
57
|
+
gh label create site-health --color b60205 \
|
|
58
|
+
--description "Live-site monitoring probe failure" 2>/dev/null || true
|
|
59
|
+
open_num="$(gh issue list --label site-health --state open --json number)"
|
|
60
|
+
echo "$open_num"
|
|
61
|
+
|
|
62
|
+
# The --repo arm, universally quantified: every detected invocation carries it,
|
|
63
|
+
# including one whose --repo sits on a continuation line, which is only found
|
|
64
|
+
# because backslash continuations are joined before matching.
|
|
65
|
+
repo_arm:
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
steps:
|
|
68
|
+
- name: every call prefixed
|
|
69
|
+
env:
|
|
70
|
+
GH_TOKEN: ${{ github.token }}
|
|
71
|
+
run: |
|
|
72
|
+
set -euo pipefail
|
|
73
|
+
gh release view v1.0.0 --repo owner/repo
|
|
74
|
+
gh release upload v1.0.0 dist/asset.tgz \
|
|
75
|
+
--clobber --repo owner/repo
|
|
76
|
+
if ! gh release view v2.0.0 --repo owner/repo; then
|
|
77
|
+
echo "absent"
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
# Whole-word matching at command position. None of these is a gh invocation, so
|
|
81
|
+
# this job is counted as invoking none rather than armed: ghost and gh-pages are
|
|
82
|
+
# other words, a leading # is always a shell comment, and a bare gh inside a
|
|
83
|
+
# string is not in command position.
|
|
84
|
+
not_invocations:
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
steps:
|
|
87
|
+
- name: tokens that are not the gh command
|
|
88
|
+
run: |
|
|
89
|
+
set -euo pipefail
|
|
90
|
+
ghost --version
|
|
91
|
+
git push origin gh-pages
|
|
92
|
+
# gh release create v9.9.9
|
|
93
|
+
echo "the gh CLI is not invoked here"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: accept-root-env
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
env:
|
|
7
|
+
GH_REPO: ${{ github.repository }}
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
# The workflow-root lookup, the outermost of the env arm's three.
|
|
11
|
+
workflow_env:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- name: no job- or step-level GH_REPO of its own
|
|
15
|
+
env:
|
|
16
|
+
GH_TOKEN: ${{ github.token }}
|
|
17
|
+
run: |
|
|
18
|
+
gh issue list --state open
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: accept-valves
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
# A job-level valve. The marker sits at the job's own key column, so it binds
|
|
8
|
+
# the job and stands the whole of it outside every arm.
|
|
9
|
+
whole_job:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
# gh-repo-exempt: the remote is established by a hand-rolled git clone, which
|
|
12
|
+
# is outside the gate's theory of how a repository context is set.
|
|
13
|
+
steps:
|
|
14
|
+
- name: a call the gate does not reach
|
|
15
|
+
env:
|
|
16
|
+
GH_TOKEN: ${{ github.token }}
|
|
17
|
+
run: |
|
|
18
|
+
git clone https://github.com/owner/repo .
|
|
19
|
+
gh issue list --state open
|
|
20
|
+
|
|
21
|
+
# A step-level valve. The marker sits inside the step's keys, so it drops that
|
|
22
|
+
# step's invocations alone; the job's other calls stay in the detected set and
|
|
23
|
+
# are held to the arms.
|
|
24
|
+
one_step:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- name: the exempted step
|
|
28
|
+
env:
|
|
29
|
+
GH_TOKEN: ${{ github.token }}
|
|
30
|
+
# gh-repo-exempt: this call targets a foreign repository resolved from a
|
|
31
|
+
# runtime input, so no tree-readable declaration can name it.
|
|
32
|
+
run: |
|
|
33
|
+
gh issue list --state open
|
|
34
|
+
|
|
35
|
+
- name: a sibling still held to the arms
|
|
36
|
+
env:
|
|
37
|
+
GH_TOKEN: ${{ github.token }}
|
|
38
|
+
run: |
|
|
39
|
+
gh issue list --repo owner/repo --state open
|