From 643754dc67ba57d71e7f264b97bd8a65a2c6091d Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 20 Oct 2020 17:44:27 +0000 Subject: [PATCH] Build/Test Tools: Cancel previous active workflow runs for pull requests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because workflow results are reported for each commit, it’s important to let all runs against main and version branches to complete so that the checks are reported accurately. When considering and reviewing pull requests, the only workflow run that matters is the most recent. Props ocean90, helen. See #50401. git-svn-id: https://develop.svn.wordpress.org/trunk@49244 602fd350-edb4-49c9-b593-d223f7449a82 --- .github/workflows/end-to-end-tests.yml | 7 +++++++ .github/workflows/javascript-tests.yml | 7 +++++++ .github/workflows/phpunit-tests.yml | 7 +++++++ .github/workflows/verify-npm-on-windows.yml | 7 +++++++ 4 files changed, 28 insertions(+) diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index 3c37381a52..aa83092d84 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -16,6 +16,7 @@ jobs: # Runs the end-to-end test suite. # # Performs the following steps: + # - Cancels all previous workflow runs for pull requests that have not completed. # - Set environment variables. # - Checks out the repository. # - Logs debug information about the runner container. @@ -34,6 +35,12 @@ jobs: name: E2E Tests runs-on: ubuntu-latest steps: + - name: Cancel previous runs of this workflow (pull requests only) + if: ${{ github.event_name == 'pull_request' }} + uses: styfle/cancel-workflow-action@0.5.0 + with: + access_token: ${{ github.token }} + - name: Configure environment variables run: | echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 40b36dfd9a..aae2476e57 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -11,6 +11,7 @@ jobs: # Runs the QUnit tests for WordPress. # # Performs the following steps: + # - Cancels all previous workflow runs for pull requests that have not completed. # - Checks out the repository. # - Logs debug information about the runner container. # - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) @@ -23,6 +24,12 @@ jobs: name: QUnit Tests runs-on: ubuntu-latest steps: + - name: Cancel previous runs of this workflow (pull requests only) + if: ${{ github.event_name == 'pull_request' }} + uses: styfle/cancel-workflow-action@0.5.0 + with: + access_token: ${{ github.token }} + - name: Checkout repository uses: actions/checkout@v2 diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index b024a1979b..16ef65deae 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -22,6 +22,7 @@ jobs: # Sets up WordPress for testing or development use. # # Performs the following steps: + # - Cancels all previous workflow runs for pull requests that have not completed. # - Checks out the repository. # - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests). # - Logs debug information about the runner container. @@ -36,6 +37,12 @@ jobs: runs-on: ubuntu-latest steps: + - name: Cancel previous runs of this workflow (pull requests only) + if: ${{ github.event_name == 'pull_request' }} + uses: styfle/cancel-workflow-action@0.5.0 + with: + access_token: ${{ github.token }} + - name: Checkout repository uses: actions/checkout@v2 diff --git a/.github/workflows/verify-npm-on-windows.yml b/.github/workflows/verify-npm-on-windows.yml index 1480e301c9..e01915a61f 100644 --- a/.github/workflows/verify-npm-on-windows.yml +++ b/.github/workflows/verify-npm-on-windows.yml @@ -14,6 +14,7 @@ jobs: # Verifies that installing NPM dependencies and building WordPress works on Windows. # # Performs the following steps: + # - Cancels all previous workflow runs for pull requests that have not completed. # - Checks out the repository. # - Logs debug information about the runner container. # - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches) @@ -24,6 +25,12 @@ jobs: name: Tests NPM on Windows runs-on: windows-latest steps: + - name: Cancel previous runs of this workflow (pull requests only) + if: ${{ github.event_name == 'pull_request' }} + uses: styfle/cancel-workflow-action@0.5.0 + with: + access_token: ${{ github.token }} + - name: Checkout repository uses: actions/checkout@v2