Skip to content

Instantly share code, notes, and snippets.

@philip-gai
Last active June 24, 2022 17:39
Show Gist options
  • Save philip-gai/94c58aa0f50ff37d98b892fb46c5a250 to your computer and use it in GitHub Desktop.
Save philip-gai/94c58aa0f50ff37d98b892fb46c5a250 to your computer and use it in GitHub Desktop.
Actions: Cancel workflow when new commits are pushed
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