Skip to content

Commit

Permalink
[ci] do not locally execute a script intended for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Sep 25, 2023
1 parent e7c60f5 commit 7397877
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions scripts/github-actions/check-format.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
#!/usr/bin/env bash

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

# The ruby version may have been set by the CI runner. Stash
# changes while we check to see if we need to reformat the
# code.
git config user.email "[email protected]"
git config user.name "CI Build"
git commit -am 'Temp commit to allow format to run cleanly'
# The ruby version may have been set by the CI runner. Stash
# changes while we check to see if we need to reformat the
# code.
git config user.email "[email protected]"
git config user.name "CI Build"
git commit -am 'Temp commit to allow format to run cleanly'

# Fail the build if the format script needs to be re-run
./scripts/format.sh
git diff --exit-code
# Fail the build if the format script needs to be re-run
./scripts/format.sh
git diff --exit-code

# Now we're made it out, reapply changes made by the build
# runner
git reset --soft HEAD^
# Now we're made it out, reapply changes made by the build
# runner
git reset --soft HEAD^
fi

0 comments on commit 7397877

Please sign in to comment.