Skip to content

ci: add chezmoi dry-run job and make targets#6

Merged
edwinhern merged 9 commits into
mainfrom
ci-chezmoi-dry-run
May 8, 2026
Merged

ci: add chezmoi dry-run job and make targets#6
edwinhern merged 9 commits into
mainfrom
ci-chezmoi-dry-run

Conversation

@edwinhern
Copy link
Copy Markdown
Owner

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.

edwinhern added 9 commits May 7, 2026 23:22
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.
@edwinhern edwinhern merged commit a75175c into main May 8, 2026
6 checks passed
@edwinhern edwinhern deleted the ci-chezmoi-dry-run branch May 8, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant