ci: repack dist/ on dependabot branches without exposing a write token #390
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.66) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.66 · 368 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.354
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.066
Real PR Conversation Timeline
1 comments
"Review active on #390"
general
weight: 0.35
jeefy
Description
Every dependabot PR that bumps an
ncc-bundled dependency permanently fails the "Verify committed dist/ matches source" gate, because dependabot never runsnpm run pack(see #167). This PR rebuildsdist/on same-repo dependabot branches and pushes the result back — reworked per review so the write credential never coexists with dependency code:repack-dist(no secrets): checks out the PR head SHA withpersist-credentials: false, installs withnpm ci --ignore-scripts, builds, packs, and uploadsdist/as an artifact only when it drifted. The bumped dependency code that runs here can read nothing.push-repacked-dist(no npm): mints a short-lived App token (actions/create-github-app-token), refuses to proceed if the branch moved since the rebuild, downloads the artifact, refuses any change outsidedist/, and pushes with--force-with-lease. Nocontents: writeis requested onGITHUB_TOKEN.Gated on
github.event.pull_request.user.login == 'dependabot[bot]'and a same-repo head.Maintainer setup required: create (or reuse) a GitHub App with
contents: write, install it on this repository, and store its id/key as the Dependabot secretsREPACK_APP_ID/REPACK_APP_PRIVATE_KEY(dependabot-triggered runs only see Dependabot secrets). Pushing with the App token is also what re-triggersbuild-teston the new commit.Follow-ups noted from review, not in this PR: a tag ruleset or an on-main check in
release.ymlto constrain what any compromised credential could ship. If the maintainers prefer the simpler route (keep the gate, hand-runnpm run pack), this PR can be dropped — #411 carries the js-yaml move independently.The js-yaml move was split out to #411 per review.
Fixes #171
Testing
npm ci --ignore-scripts && npm run build && npm run packon a clean checkout — reproduces the committeddist/byte-for-byte (git status --porcelain dist/empty), so the no-scripts rebuild is soundtest.ymlparses cleanly (js-yamlload; jobs:build-test,repack-dist,push-repacked-dist)Checklist
npm run allto lint and build my code — not applicable, workflow-onlynpm run packand committeddist/— not applicable,dist/unchangedactions/download-artifact,actions/create-github-app-token