ci: add workflow to cancel ongoing runs on pull request merge

This commit is contained in:
chenhaoran 2025-03-12 18:47:58 +08:00
parent 47344da619
commit 055154173b
2 changed files with 17 additions and 2 deletions

View File

@ -0,0 +1,15 @@
name: Cancel Workflow on Merge
on:
pull_request:
types: [closed]
jobs:
cancel-workflow:
runs-on: ubuntu-latest
steps:
- name: Cancel Workflow if Merged
if: ${{ github.event.pull_request.merged }}
run: |
echo "PR has been merged, cancelling workflow..."
gh run cancel --repo ${{ github.repository }} --workflow "TDengine Test" --branch ${{ github.event.pull_request.base.ref }}

View File

@ -11,7 +11,7 @@ on:
- 'docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-TDengine
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
@ -91,4 +91,4 @@ jobs:
needs: fetch-parameters
if: ${{ needs.fetch-parameters.outputs.run_function_test == 'true' }}
with:
tdinternal: false
tdinternal: false