From c3416a826d12a8ea3ce8f34804677602c44b24cc Mon Sep 17 00:00:00 2001 From: roottool Date: Sun, 19 Jul 2026 14:48:26 +0900 Subject: [PATCH 1/4] ci: Add shfmt formatting check for shell scripts Pairs shfmt with the existing ShellCheck lint step so shell/zsh files follow a consistent style enforced in CI, honoring the repo's .editorconfig indent settings automatically. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/ci.yaml | 6 ++++++ Brewfile | 1 + install-packages.sh | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 86e1add..d1e0a31 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -75,6 +75,12 @@ jobs: persist-credentials: false - name: ShellCheck run: find . -type f \( -name 'dot_z*' -o -name '*.sh' -o -name '*.zsh' \) | grep -Ev 'examples/*' | xargs shellcheck + - name: Setup shfmt + uses: mfinelli/setup-shfmt@a25fda4c1fe115aec0f85e04126610841bc3141d # v4.0.1 + with: + shfmt-version: "3.13.1" + - name: Check formatting (shfmt) + run: find . -type f \( -name 'dot_z*' -o -name '*.sh' -o -name '*.zsh' \) | grep -Ev 'examples/*' | xargs shfmt -d test: name: Test diff --git a/Brewfile b/Brewfile index 3f83dca..ad566ac 100644 --- a/Brewfile +++ b/Brewfile @@ -9,6 +9,7 @@ brew "dysk" brew "mkcert" brew "pipx" brew "sheldon" +brew "shfmt" brew "starship" brew "wget" brew "zizmor" diff --git a/install-packages.sh b/install-packages.sh index 6b221ba..b7f38e5 100755 --- a/install-packages.sh +++ b/install-packages.sh @@ -50,8 +50,8 @@ sudo chmod a+r /etc/apt/keyrings/docker.asc ## Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] "https://download.docker.com/linux/$DISTRO_ID" \ - $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ - sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | + sudo tee /etc/apt/sources.list.d/docker.list >/dev/null echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] "https://download.docker.com/linux/$DISTRO_ID" $(. /etc/os-release && echo "$VERSION_CODENAME") stable" # Install Docker packages and Docker compose sudo apt update From caca30be7b7c5a0e5b5b1327f6b14fb4307ce70b Mon Sep 17 00:00:00 2001 From: roottool Date: Sun, 19 Jul 2026 14:58:20 +0900 Subject: [PATCH 2/4] ci: Add shfmt formatting check for shell scripts Pairs shfmt with the existing ShellCheck lint step so shell/zsh files follow a consistent style enforced in CI, honoring the repo's .editorconfig indent settings automatically. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/ci.yaml | 6 ++++++ Brewfile | 1 + install-packages.sh | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1621faf..cce0ddf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -54,7 +54,13 @@ jobs: uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false + - name: Setup shfmt + uses: mfinelli/setup-shfmt@a25fda4c1fe115aec0f85e04126610841bc3141d # v4.0.1 + with: + shfmt-version: "3.13.1" - parallel: + - name: Check formatting (shfmt) + run: find . -type f \( -name 'dot_z*' -o -name '*.sh' -o -name '*.zsh' \) | grep -Ev 'examples/*' | xargs shfmt -d - name: ShellCheck run: find . -type f \( -name 'dot_z*' -o -name '*.sh' -o -name '*.zsh' \) | grep -Ev 'examples/*' | xargs shellcheck - name: Markdown lint diff --git a/Brewfile b/Brewfile index 3f83dca..ad566ac 100644 --- a/Brewfile +++ b/Brewfile @@ -9,6 +9,7 @@ brew "dysk" brew "mkcert" brew "pipx" brew "sheldon" +brew "shfmt" brew "starship" brew "wget" brew "zizmor" diff --git a/install-packages.sh b/install-packages.sh index 6b221ba..b7f38e5 100755 --- a/install-packages.sh +++ b/install-packages.sh @@ -50,8 +50,8 @@ sudo chmod a+r /etc/apt/keyrings/docker.asc ## Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] "https://download.docker.com/linux/$DISTRO_ID" \ - $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ - sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | + sudo tee /etc/apt/sources.list.d/docker.list >/dev/null echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] "https://download.docker.com/linux/$DISTRO_ID" $(. /etc/os-release && echo "$VERSION_CODENAME") stable" # Install Docker packages and Docker compose sudo apt update From 288ffc40b850ef8a35d3ad8aff155f0a2d279c37 Mon Sep 17 00:00:00 2001 From: roottool Date: Sun, 19 Jul 2026 15:15:44 +0900 Subject: [PATCH 3/4] ci: Change filter name --- .github/workflows/ci.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 749815d..36dcb5a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,7 +21,8 @@ jobs: outputs: markdown: ${{ steps.filter.outputs.markdown }} markdown_files: ${{ steps.filter.outputs.markdown_files }} - shellscripts: ${{ steps.filter.outputs.shellscripts }} + shellscript: ${{ steps.filter.outputs.shellscript }} + shellscript_files: ${{ steps.filter.outputs.shellscript }} if: ${{ !github.event.pull_request.draft }} steps: - name: Assign yourself to this PR @@ -44,10 +45,12 @@ jobs: filters: | markdown: - '**/*.md' - shellscripts: + shellscript: - '**/*.sh' - '**/*.zsh' - - 'dot_z*' + - 'dot_profile' + - 'dot_zprofile' + - 'dot_zsh*' - '!examples/*' lint: @@ -61,16 +64,16 @@ jobs: with: persist-credentials: false - name: Setup shfmt - if: ${{ needs.setup.outputs.shellscripts == 'true' }} + if: ${{ needs.setup.outputs.shellscript == 'true' }} uses: mfinelli/setup-shfmt@a25fda4c1fe115aec0f85e04126610841bc3141d # v4.0.1 with: shfmt-version: "3.13.1" - parallel: - name: Check formatting (shfmt) - if: ${{ needs.setup.outputs.shellscripts == 'true' }} + if: ${{ needs.setup.outputs.shellscript == 'true' }} run: find . -type f \( -name 'dot_z*' -o -name '*.sh' -o -name '*.zsh' \) | grep -Ev 'examples/*' | xargs shfmt -d - name: ShellCheck - if: ${{ needs.setup.outputs.shellscripts == 'true' }} + if: ${{ needs.setup.outputs.shellscript == 'true' }} run: find . -type f \( -name 'dot_z*' -o -name '*.sh' -o -name '*.zsh' \) | grep -Ev 'examples/*' | xargs shellcheck - name: Markdown lint if: ${{ needs.setup.outputs.markdown == 'true' }} From 7ddac2fee4295135b1984e807b410e6dfe2cf6fc Mon Sep 17 00:00:00 2001 From: roottool Date: Sun, 19 Jul 2026 15:25:56 +0900 Subject: [PATCH 4/4] ci: Use paths-filter file list instead of find/grep for shell lint steps Fixes shellscript_files output referencing the boolean output instead of the file list, avoids splicing PR-controlled filenames directly into run: scripts by passing them via env, and makes the examples/ exclusion recursive to match the previous grep-based behavior. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/ci.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 36dcb5a..c54ba7c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,7 +22,7 @@ jobs: markdown: ${{ steps.filter.outputs.markdown }} markdown_files: ${{ steps.filter.outputs.markdown_files }} shellscript: ${{ steps.filter.outputs.shellscript }} - shellscript_files: ${{ steps.filter.outputs.shellscript }} + shellscript_files: ${{ steps.filter.outputs.shellscript_files }} if: ${{ !github.event.pull_request.draft }} steps: - name: Assign yourself to this PR @@ -51,7 +51,7 @@ jobs: - 'dot_profile' - 'dot_zprofile' - 'dot_zsh*' - - '!examples/*' + - '!examples/**' lint: name: Lint @@ -71,10 +71,14 @@ jobs: - parallel: - name: Check formatting (shfmt) if: ${{ needs.setup.outputs.shellscript == 'true' }} - run: find . -type f \( -name 'dot_z*' -o -name '*.sh' -o -name '*.zsh' \) | grep -Ev 'examples/*' | xargs shfmt -d + env: + SHELLSCRIPT_FILES: ${{ needs.setup.outputs.shellscript_files }} + run: shfmt -d $SHELLSCRIPT_FILES - name: ShellCheck if: ${{ needs.setup.outputs.shellscript == 'true' }} - run: find . -type f \( -name 'dot_z*' -o -name '*.sh' -o -name '*.zsh' \) | grep -Ev 'examples/*' | xargs shellcheck + env: + SHELLSCRIPT_FILES: ${{ needs.setup.outputs.shellscript_files }} + run: shellcheck $SHELLSCRIPT_FILES - name: Markdown lint if: ${{ needs.setup.outputs.markdown == 'true' }} uses: DavidAnson/markdownlint-cli2-action@8de2aa07cae85fd17c0b35642db70cf5495f1d25 # v24.0.0