Skip to content

Latest commit

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Cancel

Release

Cancel in-progress and queued workflow runs for a branch.

What it does

  • Cancels all in-progress runs for a branch
  • Cancels all queued runs for a branch

Usage

Comment-based trigger

name: Cancel Runs Boton:
issue_comment:
types: [created]jobs:
cancel:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/cancel-runs')runs-on: ubuntu-lateststeps:
- name: Get branchid: branchrun: | branch=$(gh pr view ${{ github.event.issue.number }} --json headRefName --jq '.headRefName') echo "branch=$branch" >> $GITHUB_OUTPUT - uses: libnudget/cancel@v1with:
branch: ${{ steps.branch.outputs.branch }}

Label-based trigger

name: Cancel Runs Boton:
pull_request:
types: [labeled]jobs:
cancel:
if: github.event.label.name == 'cancel-runs'runs-on: ubuntu-lateststeps:
- uses: libnudget/cancel@v1with:
pr_number: ${{ github.event.pull_request.number }}token: ${{ secrets.GITHUB_TOKEN }}

Trigger Commands

# Comment on PR
/cancel-runs
# Label PR
cancel-runs

Inputs

InputDescriptionRequiredDefault
repoRepositoryNocurrent repo
branchBranch to cancel runs forNo*-
pr_numberPR number to get branch fromNo*-
tokenGitHub tokenYes-

*Either branch or pr_number is required.

Examples

Comment:/cancel-runsBot: Cancels all runs on the PR branch

Label:cancel-runsBot: Cancels all runs on the PR branch

License

MIT

About

Cancels workflow runs.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors