fix(pre-commit): use fresh nix eval to pick up staged changes#27
fix(pre-commit): use fresh nix eval to pick up staged changes#27lovesegfault wants to merge 3 commits into
Conversation
Path(None) raises TypeError, making the fresh nix eval code path unreachable despite the argument being marked as not required.
The pre-commit hook was using packages.render-workflows which has its workflow JSON baked in at devshell entry time. This caused the hook to render workflows based on the old flake state rather than staged changes. Now the hook runs render.py without --evaluated-ci-path, triggering a fresh `nix eval` at commit time to pick up the current working directory.
The nix eval path was never updated when flake.ci was renamed to flake.actions-nix in c4f5168. This went unnoticed because the pre-commit hook always used pre-evaluated JSON, making this code path unreachable.
|
Thanks for the PR! This would indeed be the optimal way to get the evaluated config for rendering. I attempted to get this working originally, which you can see from the unreachable code path ( However, running If you know how to get the eval working in the build sandbox, this can be implemented. I remember experimenting a bit with trying to have the "dependencies", i.e. flake inputs (e.g. I personally circumvent the stale eval by running |
|
|
Summary
The pre-commit hook was rendering workflows based on the flake state at devshell entry time, not the current staged changes. This meant users had to run
direnv reloador manually invokenix run .#render-workflowsafter modifying their workflow configuration.Root cause: The hook used
packages.render-workflowswhich has the workflow JSON pre-evaluated and baked into the derivation when the devshell is created.Fixes:
fix(render): handle missing --evaluated-ci-path argument -
Path(None)raises TypeError, making the fresh nix eval code path unreachable despite the argument being marked as not required.fix(pre-commit): use fresh nix eval instead of pre-evaluated JSON - The hook now runs render.py without
--evaluated-ci-path, triggeringnix evalat commit time to pick up current working directory state.fix(render): use correct attribute path after ci -> actions-nix rename - The nix eval path
.#ci.workflowswas never updated whenflake.ciwas renamed toflake.actions-nixin c4f5168. This went unnoticed because the pre-commit hook always used pre-evaluated JSON.Test plan
direnv reload