Skip to content

ci: pin actions, guard the release tag, split the spec-drift job - #64

Merged
cubehouse merged 1 commit into
mainfrom
chore/ci-pin-actions
Dec 5, 2026
Merged

cubehouse merged 1 commit into
mainfrom
chore/ci-pin-actions

Conversation

@cubehouse

Copy link
Copy Markdown
Member

Routine CI maintenance: pin the actions, scope the workflow token, make the release job check its tag, and split the spec-drift job in two.

Changes

  • Actions pinned to commit SHAs. Every uses: names a full commit SHA with the tag (or branch) in a trailing comment. A tag can be moved to different code; a SHA cannot. Dependabot already watches github-actions here; its bumps are now grouped into one PR.
  • Workflow token. ci.yml, mutation.yml, release.yml and spec-drift.yml declare permissions: contents: read at the top level. The first two had no block and only ever read. Jobs that write (release, the PR half of spec drift) keep their own grants. docs.yml already had a block and is unchanged apart from the pins.
  • Release: two checks before anything is installed.
    • The tagged commit must be an ancestor of origin/main (the checkout now fetches full history for this).
    • The tag must equal the version in package.json.
  • Spec drift is two jobs.
    • regenerate: npm ci, npm run regenerate, build, live smoke tests. Read-only token, no secrets, checkout credentials not persisted. Uploads the two generated files (src/_generated/schema.ts, src/_generated/dailyColumns.ts) as an artifact.
    • open-pr: fresh checkout, downloads the artifact to the runner's temp directory, copies exactly the named file(s) into place, mints the app token, opens the PR, raises the issues, and fails the run when the first job reported a failure. It runs no repository or dependency code.
    • Triggers, schedule, branch name, PR title and body, labels, issue templates and the red-run rule are the same as before.
  • Test. A new unit test holds the workflow shape in place.
Action Old ref Pinned SHA
JasonEtco/create-an-issue v2 1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5
actions/checkout v7 3d3c42e5aac5ba805825da76410c181273ba90b1
actions/create-github-app-token v3 f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc
actions/deploy-pages v5 368f82528645a54fb793d4d04e342629a3f51346
actions/setup-node v7 8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce
actions/upload-pages-artifact v5 fc324d3547104276b827a68afc52ff2a11cc49c9
peter-evans/create-pull-request v8 3ffccacd46053766916f087ce41d627c0b8cf2d1
softprops/action-gh-release v3 88b783939ccdbabad21b9a37510aed7fad5f2e60
actions/upload-artifact v7 (new in this PR) cf430e030ddbb5b0abf93d22962f4752f3646cd9
actions/download-artifact v8 (new in this PR) 9000827ccba6bdab643e8b6fd33ac0654aef8333

Behaviour changes to know about

  • A release tag on a commit that is not on main now fails the release job instead of publishing. Merge first, then tag the merged commit. A maintenance release cut from a long-lived branch other than main would also be refused; that needs a deliberate edit to the check.
  • A release tag that does not match package.json now fails instead of publishing the manifest's version under the wrong tag.
  • Spec drift shows as two jobs in the run. If the first job fails outright (for example the install step), the second is skipped: no PR and no issue, exactly as when the single job aborted at that point before.

Not in this PR

  • Publishing from a GitHub environment with a required reviewer. Left out deliberately: the trusted-publisher entry on the registry side has to name the same environment, and if the two are not changed together the next publish fails. Do both at once.
  • The GitHub release step still runs in the publishing job.

Testing

  • With the workflow changes reverted, the new test file fails (the suite does not collect: there is no regenerate/open-pr job to read); with them applied it passes (21 passed; full unit suite 321 passed, lint, prettier and typecheck clean).
  • The two release guard steps were extracted from the YAML and run against a throwaway clone: the current release tag passes both; a tag on a commit that is not on main fails the on-main step; a tag name that differs from the manifest fails the manifest step.
  • All changed YAML parses. The workflows themselves have not been run. The spec-drift split in particular is checked by reading and by the shape test only: please run it once by hand (workflow_dispatch) after merge and confirm both jobs go green before relying on the nightly run.

🤖 Generated with Claude Code

- every `uses:` names a full commit SHA, with the tag in a trailing comment;
  Dependabot's action bumps are grouped into one PR
- top-level `permissions: contents: read` in ci, mutation, release and
  spec-drift; jobs that write keep their own grants
- release.yml refuses a tag whose commit is not on main, or that does not
  match package.json, before anything is installed
- spec-drift.yml is two jobs: `regenerate` installs, regenerates, builds and
  runs the smoke tests with a read-only token and no secrets, and uploads
  the two generated files; `open-pr` copies them over a clean checkout,
  mints the app token and opens the PR. Triggers, PR, issues and the red
  run on a build failure are unchanged
- test/unit/workflows.test.ts holds the workflow shape in place

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@cubehouse
cubehouse merged commit 19c8398 into main Dec 5, 2026
3 checks passed
@cubehouse
cubehouse deleted the chore/ci-pin-actions branch December 5, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant