ci: add chezmoi dry-run job and make targets#6
Merged
Conversation
Adds a `chezmoi_dry_run` GitHub Actions job on macos-latest that installs chezmoi via the official one-liner and runs `chezmoi init --apply --dry-run --verbose --source $PWD` with stub prompt values. Catches template errors and source-state inconsistencies before they hit a real machine. Also adds `make dry-run` and `make verify` for local sanity checks.
…tring `--promptString name=value` does not satisfy `promptStringOnce` calls in .chezmoi.yaml.tmpl — those read from the data block directly. CI was hitting `could not open a new TTY` when chezmoi tried to prompt for git.name/email. Switch to pre-writing ~/.config/chezmoi/chezmoi.yaml with a stub data block, then validate the config template separately via `chezmoi execute-template`, then run `chezmoi apply --dry-run`.
`chezmoi execute-template` does not register promptStringOnce/promptChoiceOnce (those are only available during `chezmoi init`). The stub config already encodes the post-init data, so apply --dry-run alone validates source state templates without needing to also render the init template. Trade-off: .chezmoi.yaml.tmpl itself is not validated by CI. It's only used at init time on first machine setup, so breakage there is caught manually when a new machine is bootstrapped.
Three templates branch on .personal and .work flags: - home/dot_config/mise/config.toml.tmpl - home/.chezmoiscripts/darwin/run_onchange_02_install-packages.sh.tmpl - home/.chezmoiscripts/darwin/run_onchange_04_install-vscode-extensions.sh.tmpl The previous job only validated the personal path, leaving work-only package or extension list errors uncaught. Use a matrix to dry-run both, with fail-fast disabled so a regression in one context still surfaces the other's status.
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.
Adds a
chezmoi_dry_runGitHub Actions job on macos-latest that installs chezmoi via the official one-liner and runschezmoi init --apply --dry-run --verbose --source $PWDwith stub prompt values. Catches template errors and source-state inconsistencies before they hit a real machine.Also adds
make dry-runandmake verifyfor local sanity checks.