Skip to content

Keep builds out of the CI deploy job, keep its token out of the checkout, and pin the CLI - #731

Merged
dawsontoth merged 2 commits into
mainfrom
docs/ci-deploy-job-isolation
Oct 14, 2026
Merged

dawsontoth merged 2 commits into
mainfrom
docs/ci-deploy-job-isolation

Conversation

@dawsontoth

@dawsontoth dawsontoth commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

A badger shows friends a bakery split in two, with only the gatehouse owl holding the key

⊙ Problem

The CI guide's workflows, which HarperFast/skills#119 quotes word for word, had three gaps:

  • Path A's checkout left the job's token in .git/config.
  • Path A installed harper unpinned, so rerunning an old tag after a new major release would change the CLI.
  • Path B built in the job with id-token: write. A compromised dependency could request a token and trade it for the deploy user's Harper token.

🤔 Fix the docs rather than the skill?

Yes. The skill rule is generated from this page, so a skill-only fix would be undone by the next sync.

💡 Solution

🤔 Is losing ref=<tag> in private repositories acceptable?

With the token kept out, the CLI can't look a tag up on GitHub, so the page now says to pass a full commit SHA, or fetch tags with fetch-depth: 0. The alternative keeps the token in the job for that one lookup.

⚖️ Alternatives

  • An exact pin (harper@5.3.2) — every page and template would need updating per release. ^5.3 keeps a rerun on 5.x, but each new 5.x installs in the job that can request a token.
  • Raising the wait loop's 60 polls — left as is; the page now says it gives up after about ten minutes, and to raise the count on a large cluster.

🤔 Should Path B publish before an approval?

With required reviewers on production, the package now publishes before anyone approves, since the approval gates only deploy. Gating publish too would need a second approval, or a second environment.

🔧 Changes

✅ Verification

  • npm run build passes with no broken-link or anchor warnings, and npm run format:check is clean.
  • The page's three workflow blocks parse as YAML. In Path B, publish holds contents: read and packages: write only, and deploy holds id-token: write only.
  • npm view 'harper@^5.3' version resolves to 5.3.2.
  • The ref= caveat is traced in the CLI: with GITHUB_SHA set, by_ref=true needs no git lookup, while a tag missing from the checkout goes to git ls-remote.

Related: HarperFast/create-harper#151 (the same fix in the Next.js templates), HarperFast/skills#119 (the rule that quotes this page; its npm install -g harper anchor is updated to match).

🤖 Generated by Claude Code (Claude Opus 5.5); posted via @dawsontoth.

Related PRs: #722 overlaps (merged; added the reference example whose checkout and pin this carries into the guide)
Complexity: medium

Review-Coverage: authored=claude; ran=gemini,codex; adjudicated=domain; blocked=cursor-composer(no-receipt); declined=cursor-grok,cursor-kimi,cursor-muse,muse; rounds=2; full=1 @ c8f6245

Review-Attention: skim ~2m (decisions: caret-range-cli-in-token-job, publish-before-approval, path-a-single-job) @ c8f6245

dawsontoth and others added 2 commits October 14, 2026 13:59
Path B built, tested and published in the job that holds id-token: write,
so a compromised dependency's script could request the job's identity
token and trade it for the deploy user's Harper token. It now publishes
from a job without id-token, and a needs: deploy job holds the
environment and id-token and installs only the Harper CLI.

Path A's checkout sets persist-credentials: false, so the job's token
stays out of .git/config, and the workflows install harper@^5.3, the
first CLI that authenticates with the identity token, instead of an
unpinned harper. The reference pages say the deploy job is the one that
needs id-token, and to build elsewhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…itory code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gemini-code-assist[bot]

This comment was marked as resolved.

@github-actions
github-actions Bot temporarily deployed to pr-731 October 14, 2026 18:25 Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-731

This preview will update automatically when you push new commits.

@dawsontoth
dawsontoth merged commit 2dde059 into main Oct 14, 2026
17 checks passed
@dawsontoth
dawsontoth deleted the docs/ci-deploy-job-isolation branch October 14, 2026 20:56
@github-actions

Copy link
Copy Markdown

🧹 Preview Cleanup

The preview deployment for this PR has been removed.

This branch was previously deployed

1 inactive deployment
pr-731 — c8f62456 Deployed Oct 14, 2026 by github-actions[bot]
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.

2 participants