Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
play

GitHub Action

Cancel Previous Workflow Runs

v1

Cancel Previous Workflow Runs

play

Cancel Previous Workflow Runs

Cancels all previous runs of this workflow

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Cancel Previous Workflow Runs

uses: n1hility/cancel-previous-runs@v1

Learn more about this action in n1hility/cancel-previous-runs

Choose a version

cancel-previous-runs

[BETA] This action cancels all previous runs on the same branch, effectively limiting the resource consumption of the workflow using this action to one run per branch.

typescript-action status

Usage

This action should be placed as an early step in your workflow (e.g. after chekout), so that it can abort the other running jobs before consuming additional capacity. Additionally, it requires that the running Github Action token (located in the secrets context) be passed as an input parameter so that it can list and cancel workflow runs associated with the workflow's repository.

Inputs

token - The github token passed from ${{ secrets.GITHUB_TOKEN }}. Since workflow files are visible in the repository, DO NOT HARDODE A TOKEN ONLY USE A REFERENCE.

Example

  test: 
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: n1hility/cancel-previous-runs@v1
      with: 
        token: ${{ secrets.GITHUB_TOKEN }}

License

The scripts and documentation in this project are released under the MIT License