Skip to content

Commit

Permalink
ci: migrate to Github Actions Concurrency for cancelling workflows (#…
Browse files Browse the repository at this point in the history
…1158)

Replaces `styfle/cancel-workflow-action` with [Github Actions concurrency](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency). When the workflow has `cancel-in-progress: true`, this will cancel any currently running job or workflow in the same concurrency group which should be the same behaviour as `styfle/cancel-workflow-action`.

Closes #1151
  • Loading branch information
parthea authored Jan 26, 2022
1 parent d215da5 commit c1b2310
Showing 1 changed file with 4 additions and 48 deletions.
52 changes: 4 additions & 48 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: tests-${{ github.head_ref }}
cancel-in-progress: true

jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
Expand All @@ -30,10 +30,6 @@ jobs:
mypy:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
Expand All @@ -50,10 +46,6 @@ jobs:
target: [showcase, showcase_alternative_templates]
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
Expand Down Expand Up @@ -93,10 +85,6 @@ jobs:
target: [showcase_mtls, showcase_mtls_alternative_templates]
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Setup temp directory
run: |
Expand Down Expand Up @@ -156,10 +144,6 @@ jobs:
variant: _alternative_templates
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
Expand Down Expand Up @@ -187,10 +171,6 @@ jobs:
showcase-unit-add-iam-methods:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
Expand Down Expand Up @@ -221,10 +201,6 @@ jobs:
matrix:
variant: ['', _alternative_templates]
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
Expand Down Expand Up @@ -252,10 +228,6 @@ jobs:
snippetgen:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
Expand All @@ -276,10 +248,6 @@ jobs:
python: [3.6, 3.7, 3.8, 3.9]
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
Expand All @@ -305,10 +273,6 @@ jobs:
variant: _alternative_templates
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
Expand All @@ -328,10 +292,6 @@ jobs:
runs-on: ubuntu-latest
container: gcr.io/gapic-images/googleapis
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Cache Bazel files
id: cache-bazel
Expand Down Expand Up @@ -359,10 +319,6 @@ jobs:
style-check:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
Expand Down

0 comments on commit c1b2310

Please sign in to comment.