summaryrefslogtreecommitdiff
path: root/.github/workflows/setup_git.sh
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2021-11-18 13:00:39 +0100
committerMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-12-23 16:02:09 +0100
commit654f6839ebe33d64710b5e7f3c388539e84f8e35 (patch)
tree96ece0bd8ed778665a890c3e54119f7d748784cc /.github/workflows/setup_git.sh
parentc8daa7218de7904151e61f2d9a1458e63b0e3363 (diff)
downloadspack-654f6839ebe33d64710b5e7f3c388539e84f8e35.tar.gz
spack-654f6839ebe33d64710b5e7f3c388539e84f8e35.tar.bz2
spack-654f6839ebe33d64710b5e7f3c388539e84f8e35.tar.xz
spack-654f6839ebe33d64710b5e7f3c388539e84f8e35.zip
ci: run style unit tests only if we target develop (#27472)
Some tests assume the base branch is develop, but this branch may not have been checked out.
Diffstat (limited to '.github/workflows/setup_git.sh')
-rwxr-xr-x.github/workflows/setup_git.sh9
1 files changed, 4 insertions, 5 deletions
diff --git a/.github/workflows/setup_git.sh b/.github/workflows/setup_git.sh
index bd79daf268..e319e07512 100755
--- a/.github/workflows/setup_git.sh
+++ b/.github/workflows/setup_git.sh
@@ -1,9 +1,8 @@
#!/usr/bin/env sh
git config --global user.email "spack@example.com"
git config --global user.name "Test User"
-# With fetch-depth: 0 we have a remote develop
-# but not a local branch. Don't do this on develop
-if [ "$(git branch --show-current)" != "develop" ]
-then
- git branch develop origin/develop
+
+# create a local pr base branch
+if [[ -n $GITHUB_BASE_REF ]]; then
+ git fetch origin "${GITHUB_BASE_REF}:${GITHUB_BASE_REF}"
fi