diff --git a/.github/workflows/hypatia-scan.yml b/.github/workflows/hypatia-scan.yml index 05785e9..892e94d 100644 --- a/.github/workflows/hypatia-scan.yml +++ b/.github/workflows/hypatia-scan.yml @@ -28,4 +28,4 @@ permissions: jobs: scan: - uses: metadatastician/standards/.github/workflows/hypatia-scan-reusable.yml@857ff096af11451841fb10488fed1438523973a1 + uses: metadatastician/standards/.github/workflows/hypatia-scan-reusable.yml@58362c24cf225694b388fc660b3525d8207b7c61 diff --git a/.github/workflows/workflow-linter.yml b/.github/workflows/workflow-linter.yml index 98c9abc..6439429 100644 --- a/.github/workflows/workflow-linter.yml +++ b/.github/workflows/workflow-linter.yml @@ -34,16 +34,23 @@ jobs: - name: Check SPDX Headers run: | echo "=== Checking SPDX License Headers ===" + # The header comment block is read, not line 1 alone. gh actions-lock + # inserts "# This workflow is managed by gh actions-lock." at line 1 + # whenever it refreshes the lockfile, so a line-1 test fails every + # workflow the tool has touched. The test below is the one in + # standards' governance-reusable.yml: the leading run of comment + # lines must hold the identifier. failed=0 for file in .github/workflows/*.yml .github/workflows/*.yaml; do [ -f "$file" ] || continue - if ! head -1 "$file" | grep -q "^# SPDX-License-Identifier:"; then - echo "ERROR: $file missing SPDX header" + if ! awk '/^---[[:space:]]*$/ { next } /^#/ { print; next } { exit }' "$file" \ + | grep -q "^# SPDX-License-Identifier:"; then + echo "ERROR: $file has no SPDX-License-Identifier in its header comment block" failed=1 fi done if [ $failed -eq 1 ]; then - echo "Add '# SPDX-License-Identifier: MPL-2.0' as first line" + echo "Add '# SPDX-License-Identifier: ' to the header comment block" exit 1 fi echo "All workflows have SPDX headers" @@ -66,23 +73,70 @@ jobs: echo "All workflows have permissions declared" - name: Check SHA-Pinned Actions + env: + GH_TOKEN: ${{ github.token }} run: | echo "=== Checking Action Pinning ===" - # Find any uses: lines that don't have @SHA format - # Pattern: uses: owner/repo@<40-char-hex> - unpinned=$(grep -rnE "^[[:space:]]+uses:" .github/workflows/ | \ - grep -v "@[a-f0-9]\{40\}" | \ - grep -v "uses: \./\|uses: docker://\|uses: actions/github-script" || true) - - if [ -n "$unpinned" ]; then - echo "ERROR: Found unpinned actions:" - echo "$unpinned" - echo "" - echo "Replace version tags with SHA pins, e.g.:" - echo " uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6.0.1" - exit 1 + if [ -f .github/workflows/actions.lock ]; then + # Pin authority is the Actions dependency lockfile: workflows use + # readable tags, the lockfile maps each ref to an exact commit and + # the runner enforces it. Verify every action ref has a lockfile + # entry (offline coverage check). + gh extension install github/gh-actions-lock + gh actions-lock --verify-local + + # Reusable workflow calls are outside lockfile scope and must + # remain SHA-pinned inline. + # A reusable workflow call is a job-level `uses:`. With yq each + # workflow is parsed and the DECODED value is judged, so quoting, + # escapes, flow style and trailing comments cannot hide a ref: a + # call that is not local (./) must end in @ followed by exactly + # 40 lowercase hex characters. + # No parser, no verdict: reading the raw text instead would let a + # flow-style mapping or an escaped path through, so the step fails + # when yq is missing. + if ! command -v yq >/dev/null 2>&1; then + echo "ERROR: yq is not on this runner; reusable workflow refs cannot be checked" + exit 1 + fi + unpinned="" + for file in .github/workflows/*.yml .github/workflows/*.yaml; do + [ -f "$file" ] || continue + if ! calls="$(yq -r '.jobs[] | select(has("uses")) | .uses' "$file" 2>&1)"; then + echo "ERROR: $file is not parseable as YAML: $calls" + exit 1 + fi + while IFS= read -r call; do + [ -n "$call" ] || continue + case "$call" in ./*) continue ;; esac + if ! printf '%s\n' "$call" | grep -qE '@[0-9a-f]{40}$'; then + unpinned="${unpinned}${file}: ${call}"$'\n' + fi + done < <(printf '%s\n' "$calls") + done + if [ -n "$unpinned" ]; then + echo "ERROR: Found reusable workflow calls not pinned to a SHA:" + echo "$unpinned" + exit 1 + fi + echo "Lockfile coverage verified; reusable workflow calls are SHA-pinned" + else + # No lockfile: every uses: must carry an inline SHA pin. + # Pattern: uses: owner/repo@<40-char-hex> + unpinned=$(grep -rnE "^[[:space:]]+uses:" .github/workflows/ | \ + grep -v "@[a-f0-9]\{40\}" | \ + grep -v "uses: \./\|uses: docker://\|uses: actions/github-script" || true) + + if [ -n "$unpinned" ]; then + echo "ERROR: Found unpinned actions:" + echo "$unpinned" + echo "" + echo "Replace version tags with SHA pins, e.g.:" + echo " uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6.0.1" + exit 1 + fi + echo "All actions are SHA-pinned" fi - echo "All actions are SHA-pinned" - name: Check for Duplicate Workflows run: | diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 92b1e3c..1846493 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -10,6 +10,25 @@ https://semver.org/spec/v2.0.0.html[Semantic Versioning]. ==== Fixed +* *Workflow lint reads the SPDX header block and the lockfile (2026-11-17).* +The lint tested line 1 of each workflow for the SPDX identifier, but +`+gh actions-lock+` puts its own banner on line 1 whenever it refreshes the +lockfile, so the test failed on 26 of 28 workflows here and on `+main+`. It now +reads the leading comment block, the same test as `+standards+` +`+governance-reusable.yml+`; a workflow with no identifier there still fails. +The pin step required an inline commit on every action, which the move to +`+actions.lock+` made unsatisfiable (38 tag references). It now checks lockfile +coverage and keeps the inline-commit rule for reusable workflow calls, as the +copy of this lint in haec does. + +* *Stack coherence: the checker pin and the scan pin (2026-11-17).* The +invoke-slice gate pins trope-checker at `+0dceab6+` (was `+4ecba4f+`), the +commit haec and hermeneia move to in the same sweep. Between the two commits +trope-checker's `+src/+`, `+schemas/+`, `+spec/+` and conformance fixtures are +unchanged. `+zig build test+` and `+tests/e2e/invoke_slice.sh+` pass at the new +pin (Zig 0.16.0, run locally). The Hypatia scan pin moves to the revision that +installs OTP 27.3.4.19 (hypatia#1061). + * *The `+proof-check-idris2+` account was wrong (2026-11-09).* Review found it, and it was right. `+docs/status/PROOF-STATUS.adoc+` said that with a toolchain present every individual `+proof-check-*+` recipe would report green on diff --git a/tests/e2e/invoke_slice.sh b/tests/e2e/invoke_slice.sh index 27adb6c..1844292 100755 --- a/tests/e2e/invoke_slice.sh +++ b/tests/e2e/invoke_slice.sh @@ -17,7 +17,7 @@ set -euo pipefail cd "$(dirname "$0")/../.." ZIG_EXPECTED="$(awk '$1=="zig"{print $2}' .tool-versions)" -TROPECHECK_PIN="4ecba4f1862aec144ec940b1d8a93ddabd1cb591" +TROPECHECK_PIN="0dceab68459d46b2cda22137c261023223c30e9a" fail() { echo "GATE FAIL: $*" >&2; exit 1; }