Github actions have a native mechanism to cancel previous runs of the same workflow now, much like the cancel workflow we have.
+++ /dev/null
-
-name: Cancel
-on:
- workflow_run:
- workflows: ["CI"]
- types:
- - requested
-
-jobs:
- cancel:
- runs-on: ubuntu-latest
- steps:
- - uses: styfle/cancel-workflow-action@0.9.1
- with:
- workflow_id: ${{ github.event.workflow.id }}
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
+ # cancel already running jobs for the same branch/pr/tag
+ concurrency:
+ group: build-${{ github.ref }}-${{ matrix.name }}
+ cancel-in-progress: true
+
steps:
- uses: actions/checkout@v2