Skip to content

Commit 577e24d

Browse files
committed
TST: Fix cancel workflow for PRs
1 parent ccc9618 commit 577e24d

File tree

3 files changed

+17
-27
lines changed

3 files changed

+17
-27
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Cancel duplicate workflows
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI", "CodeQL"]
6+
types:
7+
- requested
8+
9+
# Note: This has to be in workflow_run so it works for PRs from forks.
10+
jobs:
11+
cancel:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Cancel previous runs
15+
uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # 0.8.0
16+
with:
17+
workflow_id: ${{ github.event.workflow.id }}

.github/workflows/ci_tests.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,9 @@ on:
1414
- cron: '0 5 * * 1'
1515

1616
jobs:
17-
cancel_ci:
18-
name: Mandatory checks before CI
19-
runs-on: ubuntu-latest
20-
steps:
21-
# TODO: Fix this for PRs
22-
- name: Cancel Previous Runs
23-
uses: styfle/cancel-workflow-action@ce177499ccf9fd2aded3b0426c97e5434c2e8a73
24-
with:
25-
access_token: ${{ secrets.GITHUB_TOKEN }}
26-
27-
# The rest only run if above are done (unless cron only)
28-
2917
tests:
3018
name: ${{ matrix.name }}
3119
runs-on: ${{ matrix.os }}
32-
needs: cancel_ci
3320
strategy:
3421
fail-fast: true
3522
matrix:
@@ -113,7 +100,6 @@ jobs:
113100
egg_info:
114101
name: egg_info with Python 3.7
115102
runs-on: ubuntu-latest
116-
needs: cancel_ci
117103
steps:
118104
- name: Checkout code
119105
uses: actions/checkout@v2

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,9 @@ on:
1919
branches: [ master ]
2020

2121
jobs:
22-
cancel_ci:
23-
name: Mandatory checks before CI
24-
runs-on: ubuntu-latest
25-
steps:
26-
# TODO: Fix this for PRs
27-
- name: Cancel Previous Runs
28-
uses: styfle/cancel-workflow-action@ce177499ccf9fd2aded3b0426c97e5434c2e8a73
29-
with:
30-
access_token: ${{ secrets.GITHUB_TOKEN }}
31-
32-
# The rest only run if above are done
33-
3422
analyze:
3523
name: Analyze
3624
runs-on: ubuntu-latest
37-
needs: cancel_ci
3825

3926
strategy:
4027
fail-fast: false

0 commit comments

Comments
 (0)