Skip to content

Commit

Permalink
Fix GitHub Actions workflow bugs
Browse files Browse the repository at this point in the history
* Remove `--track` from manual runs.
* Add missing candidate/reference for `push` event
  • Loading branch information
rcabell committed Jul 8, 2021
1 parent 3cb66da commit 93ccb4d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
runs-on: ubuntu-latest

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

- name: Checkout reference (automatic)
- name: Checkout reference (pull request)
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.base.ref }}
path: reference

- name: Checkout reference (push)
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v2
with:
ref: ${{ github.event.before }}
path: reference

- name: Checkout reference (manual)
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: gh repo clone ${{ github.repository }} reference && cd reference && git checkout --track origin/$(gh pr view ${{ github.event.inputs.pr }} --json baseRefName --jq '.baseRefName')
run: gh repo clone ${{ github.repository }} reference && cd reference && git checkout origin/$(gh pr view ${{ github.event.inputs.pr }} --json baseRefName --jq '.baseRefName')

- name: Run testing container
run: |
Expand Down

0 comments on commit 93ccb4d

Please sign in to comment.