Skip to content

Commit 8e73269

Browse files
committed
[GitHub] FIX GIT_BRANCH
1 parent 9fd39d8 commit 8e73269

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

.github/workflows/macos.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ jobs:
1919

2020
- name: Set env vars
2121
run: |
22-
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
22+
if [ -n "$GITHUB_BASE_REF" ]; then
23+
GIT_BRANCH="$GITHUB_BASE_REF"
24+
else
25+
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
26+
fi
2327
echo "GIT_BRANCH = $GIT_BRANCH"
2428
if [ -z "$GIT_BRANCH" ]; then exit 1; fi
2529
@@ -107,7 +111,11 @@ jobs:
107111
steps:
108112
- name: Set env vars
109113
run: |
110-
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
114+
if [ -n "$GITHUB_BASE_REF" ]; then
115+
GIT_BRANCH="$GITHUB_BASE_REF"
116+
else
117+
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
118+
fi
111119
echo "GIT_BRANCH = $GIT_BRANCH"
112120
if [ -z "$GIT_BRANCH" ]; then exit 1; fi
113121

.github/workflows/ubuntu.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ jobs:
1919

2020
- name: Set env vars
2121
run: |
22-
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
22+
if [ -n "$GITHUB_BASE_REF" ]; then
23+
GIT_BRANCH="$GITHUB_BASE_REF"
24+
else
25+
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
26+
fi
2327
echo "GIT_BRANCH = $GIT_BRANCH"
2428
if [ -z "$GIT_BRANCH" ]; then exit 1; fi
2529
@@ -123,7 +127,11 @@ jobs:
123127
steps:
124128
- name: Set env vars
125129
run: |
126-
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
130+
if [ -n "$GITHUB_BASE_REF" ]; then
131+
GIT_BRANCH="$GITHUB_BASE_REF"
132+
else
133+
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
134+
fi
127135
echo "GIT_BRANCH = $GIT_BRANCH"
128136
if [ -z "$GIT_BRANCH" ]; then exit 1; fi
129137

0 commit comments

Comments
 (0)