Skip to content

Commit feeb5e1

Browse files
committed
github: fix base branch on push action
1 parent 7d15a3c commit feeb5e1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ env:
1717
# /dev.Dockerfile
1818
GO_VERSION: 1.18
1919

20+
# If the action was triggered by a pull request, then the target branch of
21+
# the pull request is used as the base branch. However, if the action is a
22+
# push, then base_ref will be empty and the branch being pushed to should
23+
# instead be used as the base branch.
24+
BASE_BRANCH: ${{ github.base_ref || github.ref_name }}
25+
2026
jobs:
2127
########################
2228
# frontend build checks
@@ -219,16 +225,16 @@ jobs:
219225
with:
220226
go-version: '${{ env.GO_VERSION }}'
221227

222-
- name: fetch and rebase on ${{ github.base_ref }}
228+
- name: fetch and rebase on ${{ env.BASE_BRANCH }}
223229
run: |
224230
git remote add upstream https://github.com/${{ github.repository }}
225231
git fetch upstream
226232
export GIT_COMMITTER_EMAIL="[email protected]"
227233
export GIT_COMMITTER_NAME="LiT CI"
228-
git rebase upstream/${{ github.base_ref }}
234+
git rebase upstream/${{ env.BASE_BRANCH }}
229235
230236
- name: check commits
231-
run: scripts/check-each-commit.sh upstream/${{ github.base_ref }}
237+
run: scripts/check-each-commit.sh upstream/${{ env.BASE_BRANCH }}
232238

233239
########################
234240
# lint code

0 commit comments

Comments
 (0)