Skip to content

fix(cla): stop locking merged PRs, and enforce an append-only signature ledger #370

fix(cla): stop locking merged PRs, and enforce an append-only signature ledger

fix(cla): stop locking merged PRs, and enforce an append-only signature ledger #370

Workflow file for this run

name: CI
# Type-checks the SvelteKit admin app (svelte-check) and builds + tests the Go backend on every
# push to main and on PRs. The Go binary go:embeds frontend/build, so the frontend is built first
# (otherwise `go build` fails on the missing embed dir). modernc SQLite is pure-Go → no CGO/C
# toolchain needed.
on:
push:
branches: [main]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# The CLA signature ledger may only grow. Signatures live in
# signatures/version1/cla.json, committed to main, and the contributor-assistant action
# only ever appends to it. This step makes that invariant enforced rather than assumed:
# no pull request may drop a contributor who had already signed. It matters because
# cla.yml no longer locks merged PRs (see the comment there), so the ledger is the
# guarantee rather than the locked conversation.
- name: CLA ledger is append-only
if: github.event_name == 'pull_request'
run: |
set -euo pipefail
ledger=signatures/version1/cla.json
git fetch --no-tags --depth=1 origin "${{ github.base_ref }}"
# Bootstrap case: if the base branch has no ledger yet, there is nothing to protect.
if ! git cat-file -e "FETCH_HEAD:${ledger}" 2>/dev/null; then
echo "No CLA ledger at base; nothing to protect yet."
exit 0
fi
git show "FETCH_HEAD:${ledger}" > /tmp/cla-base.json
python3 - <<'PY'
import json, sys
def load(path):
with open(path, encoding="utf-8") as handle:
return json.load(handle)["signedContributors"]
base = load("/tmp/cla-base.json")
head = load("signatures/version1/cla.json")
# id is stable across a login rename; name is only for the message.
base_by_id = {entry["id"]: entry.get("name", "?") for entry in base}
head_ids = {entry["id"] for entry in head}
removed = [f"{name} (id {sid})" for sid, name in base_by_id.items() if sid not in head_ids]
if removed:
sys.exit("CLA signatures may not be revoked, but these were removed: " + ", ".join(removed))
print(f"CLA ledger append-only: {len(base_by_id)} signed at base, {len(head_ids)} now, none removed")
PY
- uses: pnpm/action-setup@v6
with:
version: 10.32.1
- uses: actions/setup-node@v7
with:
node-version: 22
cache: pnpm
cache-dependency-path: frontend/pnpm-lock.yaml
- name: Install frontend deps
working-directory: frontend
run: pnpm install --frozen-lockfile
- name: svelte-check (frontend types)
working-directory: frontend
run: pnpm check
- name: Build frontend (required by the Go embed)
working-directory: frontend
run: pnpm build
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: gofmt check
run: |
fmtout=$(gofmt -l .)
if [ -n "$fmtout" ]; then
echo "The following files are not gofmt'd:"
echo "$fmtout"
echo "Run: gofmt -w ."
exit 1
fi
- name: go vet
run: go vet ./...
- name: go build
run: go build ./...
- name: go test
run: go test ./...