fix(ci): generate PR body before update-flake-lock action runs#2
Merged
Merged
Conversation
The pr-body input referenced steps.generate-body.outputs.body from a step defined after the action, so it evaluated to empty at action runtime. The action passes pr-body through DamianReeves/write-file-action as a required contents input, which aborts the run with "Input required and not supplied: contents". Move generate-body ahead of the action and have it run nix flake update itself against a snapshot of the original lockfile so the jq diff has real before/after data, then restore the lockfile so the action owns the actual commit and push.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
update-flake-lockworkflow failed on its most recent scheduled run with:Root cause
The
DeterminateSystems/update-flake-lockstep setpr-body: ${{ steps.generate-body.outputs.body }}, but thegenerate-bodystep was defined after the action — so at the action's evaluation time the output didn't exist andpr-bodyresolved to an empty string. Internally the action pipespr-bodyintoDamianReeves/write-file-action's requiredcontentsinput, which aborted the run.A latent second bug: even if the steps were simply reordered,
generate-bodydiffedgit show HEAD:flake.lockagainst the on-disk file — but at that point both sides would be identical (nothing had runnix flake updateyet), so the body would always be empty.Fix
generate-bodybefore the action.generate-bodysnapshot the originalflake.lock, runnix flake updateitself, compute the jq diff against the snapshot, then restore the original lockfile soDeterminateSystems/update-flake-lockowns the actual commit and push.## Updated inputs:header line, sowrite-file-action'scontentsrequirement is satisfied (and in that case the action won't open a PR anyway).Test plan
python -c "import yaml; yaml.safe_load(...)")- <input>: \` → ``` lines for each changed inputworkflow_dispatchfrom the Actions tab and confirm a PR is opened with a populated "Updated inputs" bodyGenerated by Claude Code