From 385b7971febb28d48685b1da3d39e27eb89b7156 Mon Sep 17 00:00:00 2001 From: Ryan Cabell Date: Wed, 7 Jul 2021 18:02:19 -0600 Subject: [PATCH] Fix GitHub Actions workflow bugs * Remove `--track` from manual runs. * Add missing candidate/reference for `push` event --- .github/workflows/test-pr.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index 7b311a7d0..82179a2d7 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -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 @@ -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: | @@ -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