Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHA for automatically canceling previous CI runs #5025

Merged
merged 4 commits into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/cancel-duplicate-runs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Cancel
on:
workflow_run:
workflows: ["CI", "CI Additional", "CI Upstream"]
types:
- requested
Comment on lines +4 to +6
Copy link
Member Author

@andersy005 andersy005 Mar 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand when this special workflow is run, though. Before the creation of the individual jobs, maybe?

Yes, this workflow will run before the creation of jobs defined in ["CI", "CI Additional", "CI Upstream"] workflows.

jobs:
cancel:
name: Cancel previous runs
runs-on: ubuntu-latest
steps:
- uses: styfle/cancel-workflow-action@0.8.0
with:
workflow_id: ${{ github.event.workflow.id }}
16 changes: 0 additions & 16 deletions .github/workflows/ci-additional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ jobs:
"py38-flaky",
]
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
Expand Down Expand Up @@ -120,10 +116,6 @@ jobs:
shell: bash -l {0}

steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
Expand Down Expand Up @@ -161,10 +153,6 @@ jobs:
shell: bash -l {0}

steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
Expand Down Expand Up @@ -205,10 +193,6 @@ jobs:
shell: bash -l {0}

steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ jobs:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.7", "3.8"]
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/upstream-dev-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ jobs:
outputs:
artifacts_availability: ${{ steps.status.outputs.ARTIFACTS_AVAILABLE }}
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
Expand Down