From c1b2310b1ea08b4732b2f9d6e25a5a0d4e9ab6d8 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 26 Jan 2022 15:02:34 -0500 Subject: [PATCH] ci: migrate to Github Actions Concurrency for cancelling workflows (#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 --- .github/workflows/tests.yaml | 52 +++--------------------------------- 1 file changed, 4 insertions(+), 48 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 32f1967b12..0f32d91425 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -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 @@ -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 @@ -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 @@ -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: | @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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