Skip to content

Commit

Permalink
CI: use GitHub native concurrency to cancel workflows (#124)
Browse files Browse the repository at this point in the history
Don't install/use custom
[styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action)
actions.

Instead, use the GitHub native
[concurrency](https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/)
property to cancel workflows.

- [x] Does not require a CHANGELOG entry

Signed-off-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
  • Loading branch information
acatangiu and bkchr authored Jul 2, 2024
1 parent e28c8e8 commit e21fbb1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches: ["main", "release-*"]
pull_request:
types: [opened, reopened, synchronize, edited]
workflow_dispatch:

# cancel previous runs
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
pull_request:
workflow_dispatch:

# Cancel a currently running workflow from the same PR, branch or tag when a new workflow is
# triggered (ref https://stackoverflow.com/a/72408109)
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
rustfmt:
runs-on: ubuntu-22.04
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ jobs:
matrix:
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # v0.11.0
with:
access_token: ${{ github.token }}

- name: Install updates and protobuf-compiler
run: sudo apt update && sudo apt install --assume-yes cmake protobuf-compiler

Expand Down

0 comments on commit e21fbb1

Please sign in to comment.