Last active
June 24, 2022 17:39
-
-
Save philip-gai/94c58aa0f50ff37d98b892fb46c5a250 to your computer and use it in GitHub Desktop.
Actions: Cancel workflow when new commits are pushed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI with in-progress cancellations | |
on: | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
# This is what will cancel the workflow | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Print concurrency group | |
run: echo '${{ github.workflow }}-${{ github.ref }}' | |
- name: Sleep 15s | |
run: sleep 15s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From: https://github.com/philip-gai/philip-gai/blob/main/.github/workflows/cancel-in-progress.yml