Files

108 lines
4.6 KiB
YAML

# 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:
contents: write
pull-requests: write
concurrency:
group: origin-proof
cancel-in-progress: false
jobs:
prove:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
with:
token: ${{ secrets.FLEET_PAT }}
- 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: Propose generated origin proofs through the normal merge gates
env:
GH_TOKEN: ${{ secrets.FLEET_PAT }}
run: node scripts/ci/generated-pr.mjs origin