summaryrefslogtreecommitdiff
path: root/scripts/clang-format-diff.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/clang-format-diff.sh')
-rwxr-xr-xscripts/clang-format-diff.sh15
1 files changed, 5 insertions, 10 deletions
diff --git a/scripts/clang-format-diff.sh b/scripts/clang-format-diff.sh
index c1f1885b7..01a813f2b 100755
--- a/scripts/clang-format-diff.sh
+++ b/scripts/clang-format-diff.sh
@@ -3,17 +3,12 @@
set -o errexit
set -o pipefail
-# When we are running on travis and *not* part of a pull request we don't
-# have any upstream branch to compare against.
-if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
- echo "Skipping since not running on travis PR"
- exit 0
-fi
-
-if [ -n "$TRAVIS_BRANCH" ]; then
- BRANCH=$TRAVIS_BRANCH
+if [ -n "$1" ]; then
+ BRANCH="$1"
+elif [ -n "$GITHUB_BASE_REF" ]; then
+ BRANCH="origin/$GITHUB_BASE_REF"
else
- BRANCH=origin/main
+ BRANCH="@{upstream}"
fi
MERGE_BASE=$(git merge-base $BRANCH HEAD)