name: spec trace # Every PR description carries the spec trace (see the PR template); this # check fails a PR whose description does not. # # A read-only pull_request run checks out the event's base commit into its # own directory. Validators and data come from that checkout; the PR head # is fetched only as Git objects. The body is passed as data, not shell code. on: pull_request: # edited: the check reads the description and the base. types: [opened, synchronize, reopened, edited] permissions: contents: read concurrency: group: spec-trace-${{ github.event.pull_request.number }} cancel-in-progress: true jobs: trace: name: spec trace # Both same-repository and fork PRs use disposable hosted runners. runs-on: ubuntu-latest timeout-minutes: 5 steps: - name: Checkout base uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: ref: ${{ github.event.pull_request.base.sha }} path: trusted-base fetch-depth: 0 persist-credentials: false # The token-comparison helper is built from the base checkout too. - name: Set up Go uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 with: go-version-file: trusted-base/go.mod cache: false - name: Check spec trace working-directory: trusted-base env: BASE: ${{ github.event.pull_request.base.sha }} HEAD: ${{ github.event.pull_request.head.sha }} PR: ${{ github.event.pull_request.number }} BODY: ${{ github.event.pull_request.body }} TITLE: ${{ github.event.pull_request.title }} run: | set -euo pipefail bash .github/scripts/spec-trace-check-test.sh python3 -B .github/scripts/model-trace-check-test.py bash .github/scripts/changed-go-blobs-test.sh # fsckObjects: a PR's objects are checked as they arrive, so a tree # with a '..' or '.git' entry is refused here. git -c fetch.fsckObjects=true fetch --no-tags origin "+refs/pull/${PR}/head:refs/remotes/pr/head" printf '%s' "$BODY" >body.txt bash .github/scripts/post-merge-review-changed.sh "$BASE" "$HEAD" >changed.bin # Old and new blobs of each changed non-test Go file, for kind DOCS # (objects only; a path that would leave blobs/ is refused). mb=$(git merge-base "$BASE" "$HEAD") bash .github/scripts/changed-go-blobs.sh "$mb" "$HEAD" blobs # Mapping and validator come from the trusted base checkout above. bash .github/scripts/spec-trace-check.sh body.txt blobs .github/model-code-trace.tsv title.txt bash .github/scripts/public-text-check.sh "$mb" "$HEAD" title.txt body.txt - name: Invariants ledger anchors (report only) working-directory: trusted-base # Every code and test anchor of docs/design/invariants.md must exist at # the PR's commit (git objects only; nothing from the PR is run). It # reports and does not fail the check while the known imprecise # anchors are being corrected; then this step becomes gating. continue-on-error: true env: HEAD: ${{ github.event.pull_request.head.sha }} run: python3 -I .github/scripts/ledger_check.py . "$HEAD" || true