Skip to content

Commit 1cd19d9

Browse files
authored
sync: update .github/workflows/fortress-pre-commit.yml from source repository (#52)
1 parent 0e9a432 commit 1cd19d9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/workflows/fortress-pre-commit.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ jobs:
572572
echo "📂 ~/.cache/go-pre-commit contents:"
573573
if [[ -d "$HOME/.cache/go-pre-commit" ]]; then
574574
echo " Directory exists"
575-
find "$HOME/.cache/go-pre-commit" -type f -name "golangci-lint" -o -name "gofumpt" -o -name "gitleaks" -o -name "goimports" 2>/dev/null || echo " No tools found"
575+
find "$HOME/.cache/go-pre-commit" -type f \( -name "golangci-lint" -o -name "gofumpt" -o -name "gitleaks" -o -name "goimports" \) 2>/dev/null || echo " No tools found"
576576
else
577577
echo " ❌ Directory does not exist"
578578
fi
@@ -744,11 +744,12 @@ jobs:
744744
echo " ❌ Directory does not exist"
745745
fi
746746
echo ""
747-
echo "📂 Searching entire home directory for tool binaries:"
748-
echo " (This may take a moment...)"
747+
echo "📂 Searching common tool locations for binaries:"
748+
echo " (Checking: GOPATH/bin, .local/bin, .cache, bin)"
749749
for tool in golangci-lint gofumpt gitleaks goimports; do
750750
echo " 🔍 Searching for $tool:"
751-
find "$HOME" -type f -name "$tool" 2>/dev/null | head -5 | sed 's/^/ /' || echo " Not found"
751+
find "$HOME/go/bin" "$HOME/.local/bin" "$HOME/.cache" "$HOME/bin" \
752+
-maxdepth 3 -type f -name "$tool" 2>/dev/null | head -5 | sed 's/^/ /' || echo " Not found"
752753
done
753754
echo "==========================================================="
754755
@@ -757,10 +758,10 @@ jobs:
757758
# Primary tool: gitleaks (installed as binary by go-pre-commit)
758759
# Note: golangci-lint, gofumpt, goimports are not installed as binaries
759760
# (managed by MAGE-X or invoked via go run by go-pre-commit)
760-
# Runs on every successful execution to ensure cache is always complete and up-to-date
761+
# Only cache when tools cache was not hit - tools won't have changed if restored from cache
761762
# --------------------------------------------------------------------
762763
- name: 💾 Cache go-pre-commit tools after installation
763-
if: steps.install-pre-commit.outputs.install_success == 'true' || steps.install-pre-commit-cached.outputs.install_success == 'true'
764+
if: steps.go-pre-commit-tools-cache.outputs.cache-hit != 'true' && (steps.install-pre-commit.outputs.install_success == 'true' || steps.install-pre-commit-cached.outputs.install_success == 'true')
764765
run: |
765766
set -euo pipefail # Enable strict error handling
766767
echo "💾 Caching go-pre-commit tools..."

0 commit comments

Comments
 (0)