# Proof of origin, nightly. # # "Anyone can join the cat or steal the cat" only pays the originator if origin # can be shown. Git dates cannot show it — they are fields the committer sets — # so this run writes one manifest of every repo's HEAD, stamps it through # OpenTimestamps (a Bitcoin-anchored clock nobody here controls), asks Software # Heritage to snapshot the public repos, and commits the proofs to proofs/origin. # # Nightly rather than per-commit: the calendars batch stamps into a block every # few hours anyway, so a per-commit stamp buys nothing a nightly one does not, # and a proof directory that grows by 48 files a day is one nobody opens. A # quiet day (no HEAD moved) produces no manifest and no commit; the run still # upgrades yesterday's pending proofs to their Bitcoin attestation. name: Origin proof on: schedule: - cron: '17 3 * * *' workflow_dispatch: inputs: allow_shrink: # The script refuses to write a manifest listing FEWER repos than the # last one, and tells you to set ORIGIN_PROOF_ALLOW_SHRINK=1 when repos # really were deleted. That escape hatch had nowhere to be set: the # workflow passed no such env and takes no inputs, so the only way to # clear the guard was to run the script on a laptop and push the # manifest by hand — which nothing tells you, and which leaves the # scheduled run red until someone happens to look. # # 2026-09-18 is the first time it mattered: the count fell 48 -> 47 # because a FleetCrown scaffold repo was deliberately deleted the day # before, and origin-proof went red overnight. The guard was right; it # simply had no reachable off switch. # # Deliberately dispatch-only and default false. A shrink must stay a # human decision taken once, never something a scheduled run can do to # itself — a manifest that quietly lists fewer repos is in the proof # chain forever. description: 'Repos were really deleted or transferred — allow the manifest to shrink' type: boolean default: false permissions: # write, only to commit proofs/origin — the derived record this workflow # exists to produce. Same pattern as the register refresh in shared-inventory. contents: write # dispatch ci.yml on the commit this workflow pushes. Without it the push # lands with no CI run of its own and the auto-merge sweep blocks on # "waiting for CI to catch up" — see the re-arm at the end of the job. actions: write concurrency: group: origin-proof cancel-in-progress: false jobs: prove: runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v7 - name: OpenTimestamps client run: pipx install opentimestamps-client - name: Stamp, archive, upgrade env: # The default token reads public repos only; private ones would be # silently omitted from the manifest. FLEET_PAT is the org PAT the # auto-merge sweep already runs on, so it can see every repo. The # script refuses to write a manifest that lists FEWER repos than the # last one — a token that sees less is far likelier than repos # vanishing, and a wrong manifest is in the chain forever. GH_TOKEN: ${{ secrets.FLEET_PAT || secrets.GITHUB_TOKEN }} # Optional. Lifts the Software Heritage save limit from 10/h to 1200/h. SWH_TOKEN: ${{ secrets.SWH_TOKEN }} # Empty on every scheduled run — only a deliberate dispatch can set # it, and only for that one run. See the input's comment above. ORIGIN_PROOF_ALLOW_SHRINK: ${{ inputs.allow_shrink && '1' || '' }} run: | set -uo pipefail { echo '## Origin proof' echo echo '```' } >> "$GITHUB_STEP_SUMMARY" set +e bash scripts/ci/origin-proof.sh 2>&1 | tee -a "$GITHUB_STEP_SUMMARY" rc=${PIPESTATUS[0]} set -e echo '```' >> "$GITHUB_STEP_SUMMARY" exit "$rc" # A proof that does not match its manifest, or a chain with a broken # link, must never be committed: the commit would be the forgery. - name: The chain is intact run: bash scripts/ci/origin-proof.sh --check # The readable form: one row per public repo joining the proofs with # GitHub's first-commit date and Software Heritage's snapshot, which # bitbaum.orangecat.ch renders. generatedAt only moves when a fact does. - name: Derive the origin register env: GH_TOKEN: ${{ secrets.FLEET_PAT || secrets.GITHUB_TOKEN }} run: node scripts/ci/origin-register.mjs --emit registers/origin.json | tee -a "$GITHUB_STEP_SUMMARY" - name: Commit the proofs run: | set -euo pipefail git add proofs/origin registers/origin.json if git diff --cached --quiet; then echo "nothing new to prove today" exit 0 fi git config user.name "fleet-bot" git config user.email "noreply@bitbaum.invalid" git commit -m "chore(proofs): origin proof $(date -u +%F)" git push # RE-ARM CI ON THE COMMIT WE JUST PUSHED. # # A push made with GITHUB_TOKEN triggers no workflows, so main's CI # never runs for this commit — and the auto-merge sweep refuses to # merge anything while "main is at but the newest CI run is for # ". Every bot commit therefore STALLS THE MERGE QUEUE until a # human dispatches CI by hand, which nothing tells them to do. # # Hit four times in two days before anyone named it. It is the same # re-arm the sweep already performs after its own merges, for exactly # the same reason; the three workflows that commit to main just never # got it. # # GITHUB_TOKEN deliberately, not FLEET_PAT: this run only needs a CI # run to EXIST for the tip, and the sweep's schedule will pick it up. # A PAT dispatch would additionally emit workflow_run and wake the # sweep immediately — the cascade documented in loki CLAUDE.md, which # is not wanted here. # # Never fatal: the commit is already pushed, and failing the step # after that would report a proof as unwritten when it is written. GH_TOKEN="${{ secrets.GITHUB_TOKEN }}" gh workflow run ci.yml --ref main \ || echo "could not re-arm ci.yml — the sweep will block until it is dispatched" >&2