Skip to content

Commit

Permalink
ci(semantic-release): skip nx format:check during commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwremmel committed Feb 12, 2023
1 parent 183dcb4 commit 4619453
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
. "$(dirname -- "$0")/_/husky.sh"

# Lint staged files
Expand All @@ -17,12 +17,16 @@ if ! git diff --staged --exit-code README.md; then
git add README.md
fi

# Autofix files that nx can autofix
if ! npx nx format:check; then
echo 'nx format:check has detected files that will fail CI checks'
echo 'Please run `npx nx format:write` to fix them'
echo 'Ideally, this pre-commit hook could determine which files they are, but '
echo 'nx format only indicates there are failing files, not which ones.'
# Don't run in CI since it sem-rel may make non-conformant commits (that never
# get pushed)
if [ -z ${CI+x} ]; then
# Autofix files that nx can autofix
if ! npx nx format:check; then
echo 'nx format:check has detected files that will fail CI checks'
echo 'Please run `npx nx format:write` to fix them'
echo 'Ideally, this pre-commit hook could determine which files they are, but '
echo 'nx format only indicates there are failing files, not which ones.'

exit 1
exit 1
fi
fi

0 comments on commit 4619453

Please sign in to comment.