Skip to content

Commit a6fcdec

Browse files
Riksu9000NeroBurner
authored andcommitted
Don't allow test-format.sh to be run locally
1 parent 4434083 commit a6fcdec

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.github/workflows/format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
sudo apt-get -y install clang-format-12
2525
2626
- name: Check formatting
27-
run: tests/test-format.sh "$GITHUB_BASE_REF"
27+
run: tests/test-format.sh
2828

2929
- name: Upload patches
3030
uses: actions/upload-artifact@v3

tests/test-format.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
set -e
44

5-
[ -z "$1" ] && exit
6-
7-
basebranch=$1
5+
if [ -z "$GITHUB_BASE_REF" ]
6+
then
7+
echo "This script is only meant to be run in a GitHub Workflow"
8+
exit 1
9+
fi
810

9-
CHANGED_FILES=$(git diff --name-only "$basebranch"...HEAD)
11+
CHANGED_FILES=$(git diff --name-only "$GITHUB_BASE_REF"...HEAD)
1012

1113
CHANGED=0
1214

0 commit comments

Comments
 (0)