ci(publish): bypass main ruleset via deploy key for version-bump push - #85
Conversation
The publish workflow died at 'git push --follow-tags' with GH013: the repo ruleset requires PRs for GITHUB_TOKEN pushes to main, so the bot could never push the npm version bump and 'npm publish' never ran (npm frozen at 2.2.21 despite green releases). Same fix as api/console/chat release.yml: check out with the repo Deploy Key (SSH secret DEPLOY_KEY), which bypasses the ruleset for the version-bump push. Key added as read-write deploy key + DEPLOY_KEY secret on this repo.
| with: | ||
| fetch-depth: 0 | ||
| ref: main | ||
| ssh-key: ${{ secrets.DEPLOY_KEY }} |
There was a problem hiding this comment.
🟠 warning — Deliberate ruleset bypass via a write deploy key makes DEPLOY_KEY a standing direct-push credential for anyone who can dispatch this workflow; keep it repo-scoped/rotated or use a GitHub App as an explicit bypass actor.
| needs: test | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write |
There was a problem hiding this comment.
🟡 nit — contents: write is unneeded — the push uses the SSH deploy key and npm publish uses NPM_TOKEN; contents: read suffices.
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: main |
There was a problem hiding this comment.
🟡 nit — publish always checks out main while test runs on the dispatch ref, so dispatching from a branch publishes main code that was never tested.
| test: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read |
There was a problem hiding this comment.
✅ good — Scoped permissions on the test job follow least privilege.
ReviewSummaryThis PR makes the RiskMEDIUM — the change intentionally introduces a standing write credential (a write-capable SSH deploy key) that bypasses the main-branch ruleset for anyone who can dispatch this workflow, and publishes to NPM from it. Issues
Suggestions
ArchitectureNo structural change — this is a CI-release plumbing fix aligning this repo's publish workflow with the deploy-key pattern used by the api/console/chat release workflows. Code quality: 8/10 — small, well-commented change consistent with established org patterns; deducted for direct input interpolation and unnecessary write scope. Inline findingsBerget AI (berget/zai-org/GLM-5.3-Flash) | PR #85 |
Publish workflow failed with GH013 (ruleset requires PRs for GITHUB_TOKEN pushes to main) — the bot could never push the npm version bump, so
npm publishnever ran and npm stayed at 2.2.21.Copies the proven pattern from api/console/chat
release.yml: checkout with the repo Deploy Key (DEPLOY_KEYSSH secret, added to this repo along with its read-write deploy key) so the version-bump push bypasses the ruleset.