Skip to content

Commit 0f34cfa

Browse files
committed
TST: Enable cancel CI [ci skip]
1 parent bc4ba9f commit 0f34cfa

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/workflows/ci_tests.yml

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

1616
jobs:
17+
cancel_ci:
18+
name: Mandatory checks before CI
19+
runs-on: ubuntu-latest
20+
outputs:
21+
run_next: ${{ steps.skip_ci_step.outputs.run_next }}
22+
steps:
23+
- name: Check skip CI
24+
uses: pllim/action-skip-ci@main
25+
id: skip_ci_step
26+
with:
27+
NO_FAIL: true
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
# This should only run if we did not skip CI
30+
- name: Cancel Previous Runs
31+
uses: styfle/cancel-workflow-action@ce17749
32+
if: steps.skip_ci_step.outputs.run_next == 'true'
33+
with:
34+
access_token: ${{ secrets.GITHUB_TOKEN }}
35+
36+
# The rest only run if above are done (unless cron only)
37+
1738
tests:
1839
name: ${{ matrix.name }}
1940
runs-on: ${{ matrix.os }}
41+
needs: cancel_ci
42+
if: needs.cancel_ci.outputs.run_next == 'true'
2043
strategy:
2144
fail-fast: true
2245
matrix:
@@ -100,6 +123,8 @@ jobs:
100123
egg_info:
101124
name: egg_info with Python 3.7
102125
runs-on: ubuntu-latest
126+
needs: cancel_ci
127+
if: needs.cancel_ci.outputs.run_next == 'true'
103128
steps:
104129
- name: Checkout code
105130
uses: actions/checkout@v2

.github/workflows/codeql-analysis.yml

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

2121
jobs:
22+
cancel_ci:
23+
name: Mandatory checks before CI
24+
runs-on: ubuntu-latest
25+
outputs:
26+
run_next: ${{ steps.skip_ci_step.outputs.run_next }}
27+
steps:
28+
- name: Check skip CI
29+
uses: pllim/action-skip-ci@main
30+
id: skip_ci_step
31+
with:
32+
NO_FAIL: true
33+
SKIP_DIRECTIVES: '[skip ci],[ci skip],[skip codeql],[codeql skip]'
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
# This should only run if we did not skip CI
36+
- name: Cancel Previous Runs
37+
uses: styfle/cancel-workflow-action@ce17749
38+
if: steps.skip_ci_step.outputs.run_next == 'true'
39+
with:
40+
access_token: ${{ secrets.GITHUB_TOKEN }}
41+
42+
# The rest only run if above are done
43+
2244
analyze:
2345
name: Analyze
2446
runs-on: ubuntu-latest
47+
needs: cancel_ci
48+
if: needs.cancel_ci.outputs.run_next == 'true'
2549

2650
strategy:
2751
fail-fast: false

0 commit comments

Comments
 (0)