Skip to content

Commit 93ccb4d

Browse files
committed
Fix GitHub Actions workflow bugs
* Remove `--track` from manual runs. * Add missing candidate/reference for `push` event
1 parent 3cb66da commit 93ccb4d

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

.github/workflows/test-pr.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
runs-on: ubuntu-latest
2222

2323
steps:
24-
- name: Checkout candidate (automatic)
25-
if: ${{ github.event_name == 'pull_request' }}
24+
- name: Checkout candidate (pull request / push)
25+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
2626
uses: actions/checkout@v2
2727
with:
2828
path: candidate
@@ -33,18 +33,25 @@ jobs:
3333
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
3434
run: gh repo clone ${{ github.repository }} candidate && cd candidate && gh pr checkout -R ${{ github.repository }} ${{ github.event.inputs.pr }}
3535

36-
- name: Checkout reference (automatic)
36+
- name: Checkout reference (pull request)
3737
if: ${{ github.event_name == 'pull_request' }}
3838
uses: actions/checkout@v2
3939
with:
4040
ref: ${{ github.event.pull_request.base.ref }}
4141
path: reference
4242

43+
- name: Checkout reference (push)
44+
if: ${{ github.event_name == 'push' }}
45+
uses: actions/checkout@v2
46+
with:
47+
ref: ${{ github.event.before }}
48+
path: reference
49+
4350
- name: Checkout reference (manual)
4451
if: ${{ github.event_name == 'workflow_dispatch' }}
4552
env:
4653
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
47-
run: gh repo clone ${{ github.repository }} reference && cd reference && git checkout --track origin/$(gh pr view ${{ github.event.inputs.pr }} --json baseRefName --jq '.baseRefName')
54+
run: gh repo clone ${{ github.repository }} reference && cd reference && git checkout origin/$(gh pr view ${{ github.event.inputs.pr }} --json baseRefName --jq '.baseRefName')
4855

4956
- name: Run testing container
5057
run: |

0 commit comments

Comments
 (0)