.github/workflows/cancel-previous-runs.yml
name: Auto Cancel Previous CI Runs
on:
pull_request:
branches:
- '**'
push:
branches:
- latest
permissions:
contents: read
jobs:
cleanup-runs:
permissions:
actions: write # for rokroskar/workflow-run-cleanup-action to obtain workflow name & cancel it
contents: read # for rokroskar/workflow-run-cleanup-action to obtain branch
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
if: "github.ref != 'refs/heads/latest'"