Skip to content

Commit

Permalink
add a workflow to cancel running workflow (#2279)
Browse files Browse the repository at this point in the history
add a cancel workflow so when there is a new PR or push
previous workflow will be cancelled which will help to reduce
concurrent github runner usage.

refer to https://github.com/styfle/cancel-workflow-action#advanced-pull-requests-from-forks

according to github page [here](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_run)
this file has to be in default branch to take affect.

Signed-off-by: Lan Luo <luola@vmware.com>
  • Loading branch information
luolanzone authored Jun 17, 2021
1 parent fc803d2 commit 42077cb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/cancel_workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Cancel Workflows
on:
workflow_run:
workflows: ["Go", "Golicense", "Kind", "Build and push latest image if needed", "Antrea upgrade"]
types:
- requested
jobs:
cancel:
name: Cancel workflows
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'pull_request' }}
steps:
- uses: styfle/cancel-workflow-action@0.9.0
with:
workflow_id: ${{ github.event.workflow.id }}

0 comments on commit 42077cb

Please sign in to comment.