Skip to content
Github action to cancel previous running instances of a workflow.
Shell Dockerfile
Use this GitHub Action with your project

Add this Action to an existing workflow or create a new one.

View on Marketplace
Branch: master
Clone or download

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Dockerfile
LICENSE Initial commit Jan 30, 2020
README.md docs: Update readme with required scopes for access token (#7) Feb 26, 2020
action.yml
entrypoint.sh feat: Update kill logic (#6) Feb 11, 2020

README.md

Workflow run cleanup action

This action cleans up previously running instances of a workflow on the same branch. This accomplishes the task of automatically cancelling CI runs on pushes to the same branch, which is a common feature in most CI systems but currently not possible with GitHub actions.

Configuration

None. The action uses the GitHub action environment variables to obtain the workflow name and branch. You must, however, set the GITHUB_TOKEN environment variable:

Note: if you use a personal access token, ensure that the repo scope is included.

Example usage

uses: rokroskar/workflow-run-cleanup-action
env:
  GITHUB_TOKEN: ${{ secret.GITHUB_TOKEN }}

You may want to disable this action from running on tags or master, especially if you have CD pipelines linked to your CI passing on every commit. In that case, something like this should work:

name: CI
on:
  push: []
  jobs:
    cleanup-runs:
      runs-on: ubuntu-latest
      steps:
      - uses: rokroskar/workflow-run-cleanup-action@master
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
      if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
    ...
    other-jobs:
You can’t perform that action at this time.