fix(scripts): pass --source to chezmoi execute-template - #172
Open
github-actions[bot] wants to merge 1 commit into
Open
fix(scripts): pass --source to chezmoi execute-template#172github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
render_template() in scripts/lint-shell-templates.sh rendered templates against the default chezmoi source directory, so include directives like the one in the Rectangle reload script failed on runners where ~/.local/share/chezmoi is not the repo root. Add --source "$repo_root" so chezmoi execute-template resolves includes relative to the repository being linted. While editing this script, also split the local rendered=... declaration in lint_zsh_template() to avoid masking the return value of the command substitution (shellcheck SC2155). Closes #169 Fixes #167
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.
Automated fix attempt
This PR was generated by the
droid-issue-fixerGitHub Action, which runsdroid execheadlessly to attempt an open issue.Closes #169
Droid exec summary
Fixed #169 in
scripts/lint-shell-templates.sh.What changed:
render_template()now passes--source "$repo_root"tochezmoi execute-template, soincludedirectives resolve against the repository being linted instead of the default~/.local/share/chezmoi.local rendered=...into a separate declaration and assignment to resolve shellcheck SC2155 ([sweeper] scripts/lint-shell-templates.sh #167).Why:
private_Library/private_Preferences/run_onchange_reload-rectangle.sh.tmpl) embeds a sha256 hash viainclude "private_Library/private_Preferences/com.knollsoft.Rectangle.plist". Without--source, chezmoi looked in~/.local/share/chezmoiand failed to find the plist on CI runners.Validation:
bash -n scripts/lint-shell-templates.shpassed.shellcheck scripts/lint-shell-templates.shpassed../scripts/lint-shell-templates.shpassed for all templates.chezmoi execute-template --source /home/runner/work/dotfiles/dotfiles < private_Library/private_Preferences/run_onchange_reload-rectangle.sh.tmplnow renders successfully and produces the expected sha256 hash.