Skip to content

Commit a3c7785

Browse files
aRustyDevclaude
andcommitted
fix: Install shfmt in pre-commit job and fix nix-fmt tests
- Install shfmt binary in pre-commit workflow job - Fix nix-fmt tests to pass file arguments to the hook - This should resolve the remaining CI failures Related to #26 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0e4876d commit a3c7785

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ jobs:
5757
- name: Install pre-commit
5858
run: pip install pre-commit
5959

60+
- name: Install shfmt for pre-commit
61+
run: |
62+
wget -O /tmp/shfmt https://github.com/mvdan/sh/releases/download/v3.7.0/shfmt_v3.7.0_linux_amd64
63+
chmod +x /tmp/shfmt
64+
sudo mv /tmp/shfmt /usr/local/bin/shfmt
65+
6066
- name: Run pre-commit
6167
run: |
6268
# Skip no-commit-to-branch hook in CI

tests/nix/test_nix_fmt.bats

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pkgs.mkShell {
3030
buildInputs = [ pkgs.hello ];
3131
}' > \"\$1\""
3232

33-
run "$ORIGINAL_DIR/hooks/nix/nix-fmt.sh"
33+
run "$ORIGINAL_DIR/hooks/nix/nix-fmt.sh" default.nix
3434
[ "$status" -eq 0 ]
3535

3636
# Check file was formatted
@@ -41,7 +41,7 @@ pkgs.mkShell {
4141
# No nix files in directory
4242
mock_command "nixpkgs-fmt" "exit 0"
4343

44-
run "$ORIGINAL_DIR/hooks/nix/nix-fmt.sh"
44+
run "$ORIGINAL_DIR/hooks/nix/nix-fmt.sh" missing.nix
4545
[ "$status" -eq 0 ]
4646
}
4747

@@ -50,6 +50,6 @@ pkgs.mkShell {
5050

5151
mock_command "nixpkgs-fmt" "echo 'Error: Invalid syntax' >&2; exit 1"
5252

53-
run "$ORIGINAL_DIR/hooks/nix/nix-fmt.sh"
53+
run "$ORIGINAL_DIR/hooks/nix/nix-fmt.sh" invalid.nix
5454
[ "$status" -eq 1 ]
5555
}

0 commit comments

Comments
 (0)