interplane.Get Omega
Read in your language

aien-receipts

Append-only AIEN verification receipts, indexed by repository and exact source commit. Read verdicts, signatures and retained logs before making a claim.

Brought by drakestapleton

branch main Branches Tags History

aien-receipts / .github / workflows / audit-refresh.yml

72 lines · 3273 bytes Raw Blame History
1# Org audit refresh: mark stamps STALE when a repository's default-branch HEAD moves past the
2# stamped commit, and recount the public lines of code at every HEAD.
3# Scope (ADR 0033 addendum, aien-dev/aien-architecture-mv#337): this job may change exactly
4# audit/status.json, audit/loc/latest.json and audit/loc/history.jsonl; it fails without
5# pushing if anything else changed. Existing receipt bundles are never touched.
6name: audit-refresh
7
8on:
9 schedule:
10 - cron: "17 5 * * *"
11 workflow_dispatch:
12
13permissions: {}
14
15concurrency:
16 group: audit-refresh
17 cancel-in-progress: false
18
19jobs:
20 refresh:
21 runs-on: ubuntu-24.04
22 timeout-minutes: 180
23 permissions:
24 contents: write # push the three mutable audit files to main
25 steps:
26 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
27 with:
28 persist-credentials: false
29 - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
30 with:
31 python-version: "3.12"
32 - name: Install pinned scc (sha256-checked against audit/tools/tools.lock.json)
33 run: python3 audit/tools/install_tools.py "$RUNNER_TEMP/tools" --only scc
34 - name: Stamp status
35 run: |
36 set -uo pipefail
37 python3 audit/tools/status.py audit/stamps --out audit/status.json --org "$GITHUB_REPOSITORY_OWNER"
38 rc=$?
39 # 3 = some HEAD could not be read; those rows say UNKNOWN, which is still worth publishing
40 [ "$rc" -eq 0 ] || [ "$rc" -eq 3 ] || exit "$rc"
41 - name: Live line count
42 env:
43 GITHUB_TOKEN: ${{ github.token }}
44 run: |
45 set -uo pipefail
46 python3 audit/tools/loc_live.py --config audit/loc/repos.json --tools "$RUNNER_TEMP/tools" \
47 --latest audit/loc/latest.json --history audit/loc/history.jsonl
48 rc=$?
49 # 3 = some repository NOT_COUNTED; latest.json lists it with the reason
50 [ "$rc" -eq 0 ] || [ "$rc" -eq 3 ] || exit "$rc"
51 - name: Refuse changes outside the three mutable files
52 run: |
53 set -euo pipefail
54 git status --porcelain --untracked-files=all | cut -c4- | sort > "$RUNNER_TEMP/changed.txt"
55 printf '%s\n' audit/loc/history.jsonl audit/loc/latest.json audit/status.json > "$RUNNER_TEMP/allowed.txt"
56 extra=$(comm -23 "$RUNNER_TEMP/changed.txt" "$RUNNER_TEMP/allowed.txt")
57 if [ -n "$extra" ]; then
58 echo "::error::refresh touched files outside its scope:"; echo "$extra"; exit 1
59 fi
60 - name: Commit and push
61 env:
62 GH_TOKEN: ${{ github.token }}
63 run: |
64 set -euo pipefail
65 if git diff --quiet && [ -z "$(git status --porcelain)" ]; then echo "no change"; exit 0; fi
66 git config user.name "github-actions[bot]"
67 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
68 git add audit/status.json audit/loc/latest.json audit/loc/history.jsonl
69 git commit -q -m "audit: refresh stamp status and live line count"
70 auth=$(printf 'x-access-token:%s' "$GH_TOKEN" | base64 -w0)
71 echo "::add-mask::$auth"
72 git -c http.extraheader="AUTHORIZATION: basic $auth" push origin HEAD:main