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 385b797
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 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 All @@ -54,9 +61,11 @@ jobs:
wrfhydro/dev:modeltesting --config ${{ matrix.configuration }} --domain_tag dev
- name: Copy test results from container
if: ${{ always() }}
run: docker cp test_container:/home/docker/test_out $GITHUB_WORKSPACE/test_report

- name: Archive test results to GitHub
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: test-reports
Expand Down

0 comments on commit 385b797

Please sign in to comment.