diff --git a/.github/workflows/auto-cancel.yml b/.github/workflows/auto-cancel.yml new file mode 100644 index 000000000..4e7f228cd --- /dev/null +++ b/.github/workflows/auto-cancel.yml @@ -0,0 +1,14 @@ +# https://github.com/styfle/cancel-workflow-action#user-content-advanced-canceling-other-workflows +name: Auto-cancel-outdated PR +on: + pull_request: + types: [opened, synchronize, reopened] +jobs: + cancel: + name: Auto-cancel-outdated PR + runs-on: ubuntu-latest + steps: + - uses: styfle/cancel-workflow-action@0.10.0 + with: + workflow_id: all + access_token: ${{ github.token }} diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index a41e59518..e402e8aec 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -56,10 +56,10 @@ jobs: strategy: matrix: compiler: [gcc7, latest] - # We want to always run the tests, but after the docker image build job. + # We want to always run the tests unless cancelled, but after the docker image build job. # If there is no new build then we use the old image, else we use the new image. # The latest compiler job isn't using the built image, so it suffers the dependance of the gcc7 job. - if: ${{ always() }} + if: ${{ !cancelled() }} needs: [BuildAndPushDockerImages] steps: # Free 4Gb of workspace @@ -307,9 +307,9 @@ jobs: BuildAndTestDF: runs-on: ubuntu-latest - # We want to always run the tests, but after the docker image build job. + # We want to always run the tests unless cancelled, but after the docker image build job. # If there is no new build then we use the old image, else we use the new image. - if: ${{ always() }} + if: ${{ !cancelled() }} needs: [BuildAndPushDockerImages] steps: # A SSH private key is required as some dependencies are from private repos