Skip to content

Commit

Permalink
Update version-check.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
perara authored Dec 15, 2023
1 parent b989004 commit f7842b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ jobs:
env:
GITHUB_REF: ${{ github.event.release.tag_name }}

- name: Cancel all related workflow runs

- name: Cancel all workflow runs in the repository
if: failure()
run: |
# Fetch all workflow runs for the repo
RUNS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs" | jq '.workflow_runs[] | select(.head_branch == "${{ github.ref }}")')
"https://api.github.com/repos/${{ github.repository }}/actions/runs" | jq '.workflow_runs[] | .id')
# Iterate over each run and cancel it
for run in $(echo "${RUNS}" | jq -r .id); do
for run in $RUNS; do
curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/$run/cancel"
done
Expand Down

0 comments on commit f7842b5

Please sign in to comment.