Skip to content

Commit 7397877

Browse files
committed
[ci] do not locally execute a script intended for ci
1 parent e7c60f5 commit 7397877

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed
Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
#!/usr/bin/env bash
22

3-
set -eufo pipefail
4-
# We want to see what's going on
5-
set -x
3+
if [ ! -n "${GITHUB_WORKFLOW}" ]; then
4+
echo "Do not run this script locally; use ./scripts/format.sh"
5+
else
6+
set -eufo pipefail
7+
# We want to see what's going on
8+
set -x
69

7-
# The ruby version may have been set by the CI runner. Stash
8-
# changes while we check to see if we need to reformat the
9-
# code.
10-
git config user.email "[email protected]"
11-
git config user.name "CI Build"
12-
git commit -am 'Temp commit to allow format to run cleanly'
10+
# The ruby version may have been set by the CI runner. Stash
11+
# changes while we check to see if we need to reformat the
12+
# code.
13+
git config user.email "[email protected]"
14+
git config user.name "CI Build"
15+
git commit -am 'Temp commit to allow format to run cleanly'
1316

14-
# Fail the build if the format script needs to be re-run
15-
./scripts/format.sh
16-
git diff --exit-code
17+
# Fail the build if the format script needs to be re-run
18+
./scripts/format.sh
19+
git diff --exit-code
1720

18-
# Now we're made it out, reapply changes made by the build
19-
# runner
20-
git reset --soft HEAD^
21+
# Now we're made it out, reapply changes made by the build
22+
# runner
23+
git reset --soft HEAD^
24+
fi

0 commit comments

Comments
 (0)