From 4452b5cb19af575c234c74234621c9bb935add7b Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 29 Jun 2023 14:21:22 +0800 Subject: [PATCH] Use concurrency to cancel previous runs (#2589) --- .github/workflows/ci_docs.yml | 10 ++++------ .github/workflows/ci_doctests.yaml | 10 ++++------ .github/workflows/ci_tests.yaml | 10 ++++------ .github/workflows/ci_tests_dev.yaml | 10 ++++------ .github/workflows/ci_tests_legacy.yaml | 10 ++++------ 5 files changed, 20 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 87d689b0926..298bffdc0a6 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -29,6 +29,10 @@ on: types: - published +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + jobs: docs: name: ${{ matrix.os }} @@ -52,12 +56,6 @@ jobs: shell: bash -l {0} steps: - # Cancel previous runs that are not completed - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - # Checkout current git repository - name: Checkout uses: actions/checkout@v3.5.3 diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index b2a35d8dcce..469d7dd7e3b 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -13,6 +13,10 @@ on: schedule: - cron: '0 0 * * 0' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + jobs: test: name: ${{ matrix.os }} @@ -27,12 +31,6 @@ jobs: shell: bash -l {0} steps: - # Cancel previous runs that are not completed - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - # Checkout current git repository - name: Checkout uses: actions/checkout@v3.5.3 diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index a5c062d522d..9d320e7fc19 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -41,6 +41,10 @@ on: schedule: - cron: '0 0 * * *' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + jobs: test: name: ${{ matrix.os }} - Python ${{ matrix.python-version }} / NumPy ${{ matrix.numpy-version }} @@ -81,12 +85,6 @@ jobs: NUMPY: ${{ matrix.numpy-version }} steps: - # Cancel previous runs that are not completed - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - # Checkout current git repository - name: Checkout uses: actions/checkout@v3.5.3 diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index 08864afffb2..73742823e35 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -31,6 +31,10 @@ on: schedule: - cron: '0 0 * * 1,3,5' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + jobs: test_gmt_dev: name: ${{ matrix.os }} - GMT ${{ matrix.gmt_git_ref }} @@ -46,12 +50,6 @@ jobs: shell: bash -l {0} steps: - # Cancel previous runs that are not completed - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - # Checkout current git repository - name: Checkout uses: actions/checkout@v3.5.3 diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index 34423a5ad0a..4aee2f1d438 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -24,6 +24,10 @@ on: schedule: - cron: '0 0 * * 2' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + jobs: test: name: ${{ matrix.os }} - GMT ${{ matrix.gmt_version }} @@ -39,12 +43,6 @@ jobs: shell: bash -l {0} steps: - # Cancel previous runs that are not completed - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - # Checkout current git repository - name: Checkout uses: actions/checkout@v3.5.3