Skip to content

Commit 92146ff

Browse files
kyliauKeen Yee Liau
authored andcommitted
fix: run format check iff on CI
When running `yarn format` locally the CI check should not be triggered. Run the formatting check only when "CIRCLECI" is present in the environment variables. `CIRCLECI` is a built-in environment variable that's always set according to https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables
1 parent 747edc2 commit 92146ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ find . -name "*.ts" \
1212
find syntaxes/ -name "*.json" \
1313
-exec yarn prettier --write {} +
1414

15-
if [[ -n "$(git status --porcelain)" ]]; then
15+
if [[ -n "${CIRCLECI}" && -n "$(git status --porcelain)" ]]; then
1616
echo "Files not formatted; please run 'yarn format'."
1717
exit 1
1818
fi

0 commit comments

Comments
 (0)