Automate flake pin bumps on new @machine0/cli releases - #2
Conversation
update-pin.yml bumps the pin via update.sh (repository_dispatch from the CLI publish workflow, daily cron fallback, manual dispatch), gates the commit on nix build + smoke test, and pushes directly to main. ci.yml adds an ubuntu+macos build matrix for post-merge darwin signal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The red CI here is a pre-existing breakage on
Two ways to fix, pick one:
Until one of these lands, the automation in this PR fails safe: |
@machine0/cli gained unbundled runtime deps (open, update-notifier) between 1.0.140 and 1.0.148, silently breaking the fetch-and-wrap packaging — nix run died with ERR_MODULE_NOT_FOUND. Switch to buildNpmPackage with a vendored package-lock.json + npmDepsHash; update.sh now regenerates both on every bump. The published package.json's bun workspace:* devDependencies are stripped before npm sees them. npmDepsHash is a placeholder; the update-pin workflow recomputes it in CI (prefetch-npm-deps) in the next commit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Hash computed by CI's fetchNpmDeps (placeholder round-trip). greptile.json mirrors fdmtl/machine0's conventions: skip bot-authored changes and the vendored lockfile. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Resolved in this PR (option 2, flake-side): switched to |
|
@greptileai review |
Greptile SummaryThe PR automates
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| .github/workflows/update-pin.yml | Adds the automated update workflow and fully addresses the previously reported branch targeting, action pinning, rebase validation, and retry-loop issues. |
| .github/workflows/ci.yml | Adds SHA-pinned Linux and macOS Nix build coverage. |
| update.sh | Extends pin generation to regenerate the runtime dependency lockfile and compute npmDepsHash. |
| flake.nix | Migrates packaging to buildNpmPackage so the CLI's external runtime dependencies are installed. |
| README.md | Documents automated pin updates, manual invocation, and rollback behavior. |
Sequence Diagram
sequenceDiagram
actor Trigger as Dispatch / Cron / Maintainer
participant Workflow as update-pin workflow
participant NPM as npm registry
participant Nix as Nix build
participant Main as main branch
Trigger->>Workflow: Start update
Workflow->>NPM: Resolve and fetch CLI version
Workflow->>Workflow: Regenerate pins and lockfile
Workflow->>Nix: Build and smoke-test
alt No pin changes
Workflow-->>Trigger: Exit successfully
else Pin changed
Workflow->>Main: Push validated commit
alt main advanced
Workflow->>Main: Rebase onto current main
Workflow->>Nix: Rebuild and smoke-test rebased tree
Workflow->>Main: Retry push
end
end
Reviews (4): Last reviewed commit: "Skip pointless rebase+rebuild after fina..." | Re-trigger Greptile
- Pin actions to commit SHAs (mutable-tag supply chain) - checkout ref: main + fetch-depth 0 in update-pin so any dispatch ref still lands the bump on main (also fixes rollback-from-branch) - Rebase-and-retry push loop for races with concurrent main pushes Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A clean rebase onto advanced main (e.g. a concurrent flake.lock change) produces a tree that was never built; re-run nix build + smoke test before each push retry so no unvalidated combination lands on main. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
What
.github/workflows/update-pin.yml— bumps the@machine0/clipin inflake.nixby running the existing./update.sh, then gates the commit onnix build+--version/--helpsmoke test before pushing tomain. Triggered three ways:repository_dispatch(cli-published) fired bydeploy-cli.ymlinfdmtl/machine0afternpm publish(companion PR in fdmtl/machine0)latestif a dispatch was missed)workflow_dispatchwith an optionalversioninput (also the rollback path).github/workflows/ci.yml— ubuntu + macosnix buildmatrix on push/PR; the bump pipeline gates on ubuntu only, so this catches darwin-only breakage.Notes
cachix/install-nix-action(upstream Nix) —DeterminateSystems/nix-installer-actioninstalls Determinate Nix by default and dropped upstream-Nix support on 2026-01-01.FLAKE_REPO_DISPATCH_TOKENsecret in fdmtl/machine0 (fine-grained PAT, Contents RW on this repo) andmainallowing pushes fromgithub-actions[bot].Verification (after merge)
gh workflow run update-pin.ymlwith no input → expect no-op (pin already latest)version: 9.9.9→ expect 5 retries then red job, no commitgh api repos/fdmtl/machine0-cli-nix/dispatches -f event_type=cli-published -f 'client_payload[version]=1.0.148'→ workflow fires, no-opspin @machine0/cli@<new>commit lands on main