checkwright 0.21.0 → 0.22.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/README.md +385 -19
- package/lib/common/digest.sh +18 -0
- package/lib/common/lock.sh +11 -0
- package/lib/common/recipe.sh +8 -11
- package/lib/doctor.sh +49 -0
- package/lib/init.sh +152 -29
- package/package.json +2 -2
- package/payload/artifact/targets.list +30 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
- package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
- package/payload/canon-kit/README.md +1 -0
- package/payload/canon-kit/SPEC.md +279 -24
- package/payload/canon-kit/checks/check-comment-tier.sh +7 -2
- package/payload/canon-kit/checks/check-docs-link-convention.sh +11 -4
- package/payload/canon-kit/checks/check-payload-claim.sh +133 -0
- package/payload/canon-kit/checks/check-prose-enum.sh +1 -1
- package/payload/canon-kit/checks/check-spec-pointer.sh +9 -2
- package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
- package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +26 -3
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/OUTSIDE.md +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/OUTSIDE.md +4 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +8 -0
- package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +94 -0
- package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +5 -3
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/README.md +15 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/install.md +19 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/posts/note.md +6 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/payload-claims.sh +7 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/README.md +15 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/expect.txt +2 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/install.md +20 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/posts/note.md +6 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +8 -0
- package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/payload-claims.sh +7 -0
- package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +24 -1
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +1 -0
- package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +1 -0
- package/payload/canon-kit/lib/spec.sh +22 -12
- package/payload/canon-kit/smoke/install.sh +20 -1
- package/payload/canon-kit/templates/SPEC-amendment.md +5 -1
- package/payload/context-kit/SPEC.md +25 -1
- package/payload/context-kit/lib/toolfloor.sh +1 -1
- package/payload/context-kit/smoke/install.sh +3 -1
- package/payload/delegation-kit/SPEC.md +383 -13
- package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +97 -0
- package/payload/delegation-kit/checks/check-gate-tamper.sh +1 -1
- package/payload/delegation-kit/lib/delegation.sh +1 -0
- package/payload/delegation-kit/smoke/install.sh +2 -1
- package/payload/delegation-kit/templates/agent-dispatch-guard.sh +61 -0
- package/payload/delegation-kit/templates/agent-execution.md +103 -12
- package/payload/delegation-kit/templates/delegation-config.sh +4 -0
- package/payload/delegation-kit/templates/dispatch-checklists.md +1 -1
- package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +30 -0
- package/payload/doctrine-kit/DOCTRINE.md +27 -0
- package/payload/doctrine-kit/README.md +5 -0
- package/payload/doctrine-kit/SPEC.md +62 -3
- package/payload/doctrine-kit/bin/install-doctrine.sh +84 -4
- package/payload/doctrine-kit/smoke/install.sh +77 -1
- package/payload/drift-kit/README.md +3 -2
- package/payload/drift-kit/SPEC.md +253 -20
- package/payload/drift-kit/bin/stage-economics.sh +157 -3
- package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +42 -0
- package/payload/drift-kit/smoke/install.sh +155 -1
- package/payload/drift-kit/templates/economics.md +9 -0
- package/payload/drift-kit/templates/kpis.list +6 -1
- package/payload/evidence-kit/README.md +20 -6
- package/payload/evidence-kit/SPEC.md +355 -17
- package/payload/evidence-kit/bin/run-validate.sh +51 -9
- package/payload/evidence-kit/checks/check-battery-roster.sh +86 -0
- package/payload/evidence-kit/checks/check-producer-liveness.sh +34 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/args +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/runner.md +14 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +7 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/args +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/runner.md +14 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +7 -0
- package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +68 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/args +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/expect.txt +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/run-validate.lock +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/args +1 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/expect.txt +2 -0
- package/payload/evidence-kit/gate-tests/check-producer-liveness/good/run-validate.lock +1 -0
- package/payload/evidence-kit/gate-tests/producer-lock.test.sh +109 -0
- package/payload/evidence-kit/lib/evidence.sh +18 -0
- package/payload/evidence-kit/smoke/install.sh +17 -3
- package/payload/gate-sdk/README.md +4 -1
- package/payload/gate-sdk/SPEC.md +1949 -74
- package/payload/gate-sdk/bin/gen-pre-commit.sh +12 -2
- package/payload/gate-sdk/bin/run-consumer-smoke.sh +121 -1
- package/payload/gate-sdk/bin/run-gate-tests.sh +40 -9
- package/payload/gate-sdk/bin/run-gates.sh +31 -2
- package/payload/gate-sdk/bin/upgrade-smoke.sh +3 -3
- package/payload/gate-sdk/checks/check-action-gh-repo.gate +2 -0
- package/payload/gate-sdk/checks/check-action-pinning.gate +2 -0
- package/payload/gate-sdk/checks/check-action-run-shell.sh +3 -1
- package/payload/gate-sdk/checks/check-core-files.sh +27 -4
- package/payload/gate-sdk/checks/check-exec-bit.sh +20 -1
- package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +106 -0
- package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +6 -7
- package/payload/gate-sdk/checks/check-gate-output.sh +9 -1
- package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +302 -0
- package/payload/gate-sdk/checks/check-graph.sh +4 -5
- package/payload/gate-sdk/checks/check-readme-roster.sh +5 -0
- package/payload/gate-sdk/checks/check-reads-couples.sh +70 -21
- package/payload/gate-sdk/checks/check-template-registry-parity.sh +81 -0
- package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +16 -1
- package/payload/gate-sdk/gate-tests/check-core-files.test.sh +64 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/kitroot/checks/check-vendored.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stamp.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stub-bin +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/expect.txt +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/kitroot/checks/check-vendored.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gates.list +4 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stamp.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stub-bin +5 -0
- package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +81 -0
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +3 -1
- package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/conservation.md +7 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +12 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/impl/gate.rs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kitroot/check-orphan.rs +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/publish.yml +15 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +1 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/targets.list +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/args +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/conservation.md +8 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/impl/gate.rs +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kitroot/check-other.rs +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/publish.yml +15 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-ported.gate +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +6 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +3 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/targets.list +2 -0
- package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +123 -0
- package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +139 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/templates/widgets.list +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/templates/widgets.list +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-one.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-two.sh +3 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +8 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/rules.list +5 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/table.tsv +4 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -0
- package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +5 -0
- package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +4 -4
- package/payload/gate-sdk/gate-tests/lib-gate.test.sh +41 -1
- package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +144 -0
- package/payload/gate-sdk/lib/consumer-smoke.sh +26 -1
- package/payload/gate-sdk/lib/gate.sh +75 -0
- package/payload/gate-sdk/lib/inject.sh +21 -1
- package/payload/gate-sdk/smoke/install.sh +19 -1
- package/payload/guard-kit/README.md +4 -3
- package/payload/guard-kit/SPEC.md +88 -10
- package/payload/guard-kit/bin/compare-settings-allow.sh +40 -7
- package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +64 -0
- package/payload/guard-kit/lib/guard.sh +1 -0
- package/payload/guard-kit/templates/close-triage.md +35 -7
- package/payload/guard-kit/templates/guard-config.sh +3 -0
- package/payload/lifecycle-kit/README.md +1 -0
- package/payload/lifecycle-kit/SPEC.md +575 -29
- package/payload/lifecycle-kit/bin/enter-stage.sh +13 -3
- package/payload/lifecycle-kit/bin/file-gap.sh +42 -1
- package/payload/lifecycle-kit/bin/file-survey.sh +50 -0
- package/payload/lifecycle-kit/checks/check-merge-attrs.sh +1 -1
- package/payload/lifecycle-kit/checks/check-skill-binding.sh +1 -1
- package/payload/lifecycle-kit/checks/check-survey-record.sh +102 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +1 -0
- package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +1 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +18 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/args +2 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +13 -0
- package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +84 -0
- package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +94 -0
- package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +102 -0
- package/payload/lifecycle-kit/lib/stages.sh +8 -2
- package/payload/lifecycle-kit/smoke/install.sh +17 -1
- package/payload/lifecycle-kit/templates/consult.md +73 -0
- package/payload/lifecycle-kit/templates/lead.md +103 -7
- package/payload/lifecycle-kit/templates/stages/align.md +12 -0
- package/payload/lifecycle-kit/templates/stages/build.md +8 -0
- package/payload/lifecycle-kit/templates/stages/close.md +25 -4
- package/payload/lifecycle-kit/templates/stages/scope.md +34 -0
- package/payload/lifecycle-kit/templates/stages/spec.md +8 -0
- package/payload/lifecycle-kit/templates/stages/validate.md +8 -0
- package/payload/queue-kit/README.md +4 -1
- package/payload/queue-kit/SPEC.md +230 -6
- package/payload/queue-kit/bin/queue-edges.sh +78 -0
- package/payload/queue-kit/checks/check-queue-entry-budget.sh +5 -3
- package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +5 -0
- package/payload/queue-kit/gate-tests/queue-edges.test.sh +130 -0
- package/payload/queue-kit/smoke/install.sh +4 -1
- package/payload/queue-kit/templates/TASK-QUEUE.md +3 -0
- package/payload/site-kit/SPEC.md +41 -27
- package/payload/site-kit/smoke/install.sh +9 -1
- package/payload/gate-sdk/checks/check-action-gh-repo.sh +0 -321
- package/payload/gate-sdk/checks/check-action-pinning.sh +0 -55
|
@@ -8,6 +8,14 @@ SDK="$SMOKE_KIT_ROOT/../gate-sdk" # the vendored gate-sdk beside this kit
|
|
|
8
8
|
cat >> scripts/gates.list <<'EOF'
|
|
9
9
|
# site-kit
|
|
10
10
|
check-docs-cname-parity
|
|
11
|
+
# spec: gate-sdk/SPEC.md §Consumer smoke — gate-sdk gates registered by the kit whose
|
|
12
|
+
# install writes their subject: the site-health workflow copied in below is the only
|
|
13
|
+
# Actions-shaped surface any install writes, so these three lint installed content
|
|
14
|
+
# rather than passing vacuously.
|
|
15
|
+
check-action-pinning
|
|
16
|
+
check-action-run-shell
|
|
17
|
+
check-action-gh-repo
|
|
18
|
+
check-docs-render-fidelity
|
|
11
19
|
EOF
|
|
12
20
|
|
|
13
21
|
# spec: gate-sdk/SPEC.md §Consumer smoke — the gated source of truth for the
|
|
@@ -23,4 +31,4 @@ mkdir -p .github/workflows
|
|
|
23
31
|
cp "$SMOKE_KIT_ROOT/templates/site-health.yml" .github/workflows/site-health.yml
|
|
24
32
|
|
|
25
33
|
bash "$SDK/bin/gen-pre-commit.sh" --write >/dev/null
|
|
26
|
-
bash "$SDK/checks/check-graph.sh" --emit >
|
|
34
|
+
bash "$SDK/checks/check-graph.sh" --emit > scripts/CHECK-GRAPH.html
|
|
@@ -1,321 +0,0 @@
|
|
|
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
|
|
@@ -1,55 +0,0 @@
|
|
|
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-pinning — every `uses:` ref in a scanned YAML file is immutable: a full 40-hex commit SHA, or a repo-local ./ path git pins at checkout
|
|
4
|
-
#
|
|
5
|
-
# usage: check-action-pinning.sh [scan-root]
|
|
6
|
-
# scan-root: the walked tree (default '.').
|
|
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-pinning: 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-PINNING gate_find
|
|
18
|
-
mapfile -t files < <(printf '%s' "$listing")
|
|
19
|
-
|
|
20
|
-
if [[ ${#files[@]} -eq 0 ]]; then
|
|
21
|
-
echo "ACTION-PINNING: clean (no YAML under $SCANROOT — 0 uses: refs to pin)"
|
|
22
|
-
exit 0
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
scan="$(awk '
|
|
26
|
-
match($0, /^[[:space:]]*(#[[:space:]]*)?(-[[:space:]]+)?uses:[[:space:]]*/) {
|
|
27
|
-
v = substr($0, RSTART + RLENGTH)
|
|
28
|
-
sub(/[[:space:]].*$/, "", v)
|
|
29
|
-
gsub(/^[\047"]+|[\047"]+$/, "", v)
|
|
30
|
-
if (v != "") printf "%s:%d\t%s\n", FILENAME, FNR, v
|
|
31
|
-
}
|
|
32
|
-
' "${files[@]}")"; st=$?
|
|
33
|
-
fail_closed "$st" ACTION-PINNING awk
|
|
34
|
-
|
|
35
|
-
refs=0; stray=()
|
|
36
|
-
while IFS=$'\t' read -r loc ref || [[ -n "$loc" ]]; do
|
|
37
|
-
[[ -n "$ref" ]] || continue
|
|
38
|
-
refs=$((refs + 1))
|
|
39
|
-
[[ "$ref" == ./* ]] && continue
|
|
40
|
-
[[ "$ref" =~ @[0-9a-f]{40}$ ]] && continue
|
|
41
|
-
stray+=("$loc: $ref")
|
|
42
|
-
done <<< "$scan"
|
|
43
|
-
|
|
44
|
-
if [[ ${#stray[@]} -gt 0 ]]; then
|
|
45
|
-
echo "check-action-pinning: mutable action ref — a tag or branch is repointable by"
|
|
46
|
-
echo "whoever owns it, so the code a run executes is not the code that was reviewed:"
|
|
47
|
-
printf ' %s\n' "${stray[@]}"
|
|
48
|
-
echo " help: replace the ref with the full 40-hex commit SHA the tag resolves to,"
|
|
49
|
-
echo " keeping the tag as a trailing comment (uses: owner/repo@<sha> # v1.2.3)."
|
|
50
|
-
echo " A repo-local ./ action needs no pin — the checkout already pins it."
|
|
51
|
-
exit 1
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
echo "ACTION-PINNING: clean ($refs uses: ref(s) across ${#files[@]} YAML file(s) under $SCANROOT, all immutable)"
|
|
55
|
-
exit 0
|