From 739787747b5141335d1640e64a85e7b11b7efb1c Mon Sep 17 00:00:00 2001 From: titusfortner Date: Mon, 25 Sep 2023 07:37:23 -0500 Subject: [PATCH] [ci] do not locally execute a script intended for ci --- scripts/github-actions/check-format.sh | 34 ++++++++++++++------------ 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/scripts/github-actions/check-format.sh b/scripts/github-actions/check-format.sh index dcd659090d39a..f0a16d6304d35 100755 --- a/scripts/github-actions/check-format.sh +++ b/scripts/github-actions/check-format.sh @@ -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 "selenium@example.com" -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 "selenium@example.com" + 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