Skip to content

Commit

Permalink
workflows cancel pending workflow on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
silverqx committed Jun 12, 2024
1 parent 5e9fb80 commit 05b77c6
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/linux-qt6-drivers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,19 @@ jobs:
fi
env:
GH_TOKEN: ${{ github.token }}

- name: Cancel vcpkg-linux.yml workflow (on failure)
if: ${{ failure() }}
working-directory: ${{ env.TinyORMPath }}
run: |
databaseId=$(gh run list --workflow vcpkg-linux.yml --event workflow_dispatch \
--json databaseId,conclusion,status \
--jq '.[] | select (.status == "pending") | select (.conclusion == "") | .databaseId')
if [ $? -eq 0 ] && [[ "$databaseId" != "" && "$databaseId" =~ ^[0-9]+$ ]] &&
[ $databaseId -gt 0 ]
then
gh run cancel $databaseId
fi
env:
GH_TOKEN: ${{ github.token }}
16 changes: 16 additions & 0 deletions .github/workflows/msvc2022-qt6-drivers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,19 @@ jobs:
}
env:
GH_TOKEN: ${{ github.token }}

- name: Cancel vcpkg-windows.yml workflow (on failure)
if: ${{ failure() }}
working-directory: ${{ env.TinyORMPath }}
run: |
$databaseId = gh run list --workflow vcpkg-windows.yml --event workflow_dispatch `
--json databaseId,conclusion,status `
--jq '.[] | select (.status == "pending") | select (.conclusion == "") | .databaseId'
if ($? -and $null -ne $databaseId -and $databaseId -match '^\d+$' -and
[int64] $databaseId -ne 0
) {
gh run cancel $databaseId
}
env:
GH_TOKEN: ${{ github.token }}
16 changes: 16 additions & 0 deletions .github/workflows/vcpkg-linux-drivers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -538,3 +538,19 @@ jobs:
fi
env:
GH_TOKEN: ${{ github.token }}

- name: Cancel analyzers.yml workflow (on failure)
if: ${{ failure() }}
working-directory: ${{ env.TinyORMPath }}
run: |
databaseId=$(gh run list --workflow analyzers.yml --event workflow_dispatch \
--json databaseId,conclusion,status \
--jq '.[] | select (.status == "pending") | select (.conclusion == "") | .databaseId')
if [ $? -eq 0 ] && [[ "$databaseId" != "" && "$databaseId" =~ ^[0-9]+$ ]] &&
[ $databaseId -gt 0 ]
then
gh run cancel $databaseId
fi
env:
GH_TOKEN: ${{ github.token }}
16 changes: 16 additions & 0 deletions .github/workflows/vcpkg-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -495,3 +495,19 @@ jobs:
fi
env:
GH_TOKEN: ${{ github.token }}

- name: Cancel vcpkg-linux-drivers.yml workflow (on failure)
if: ${{ failure() }}
working-directory: ${{ env.TinyORMPath }}
run: |
databaseId=$(gh run list --workflow vcpkg-linux-drivers.yml --event workflow_dispatch \
--json databaseId,conclusion,status \
--jq '.[] | select (.status == "pending") | select (.conclusion == "") | .databaseId')
if [ $? -eq 0 ] && [[ "$databaseId" != "" && "$databaseId" =~ ^[0-9]+$ ]] &&
[ $databaseId -gt 0 ]
then
gh run cancel $databaseId
fi
env:
GH_TOKEN: ${{ github.token }}
16 changes: 16 additions & 0 deletions .github/workflows/vcpkg-windows-drivers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -541,3 +541,19 @@ jobs:
}
env:
GH_TOKEN: ${{ github.token }}

- name: Cancel msys2-ucrt64-drivers.yml workflow (on failure)
if: ${{ failure() }}
working-directory: ${{ env.TinyORMPath }}
run: |
$databaseId = gh run list --workflow msys2-ucrt64-drivers.yml --event workflow_dispatch `
--json databaseId,conclusion,status `
--jq '.[] | select (.status == "pending") | select (.conclusion == "") | .databaseId'
if ($? -and $null -ne $databaseId -and $databaseId -match '^\d+$' -and
[int64] $databaseId -ne 0
) {
gh run cancel $databaseId
}
env:
GH_TOKEN: ${{ github.token }}
16 changes: 16 additions & 0 deletions .github/workflows/vcpkg-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -505,3 +505,19 @@ jobs:
}
env:
GH_TOKEN: ${{ github.token }}

- name: Cancel vcpkg-windows-drivers.yml workflow (on failure)
if: ${{ failure() }}
working-directory: ${{ env.TinyORMPath }}
run: |
$databaseId = gh run list --workflow vcpkg-windows-drivers.yml --event workflow_dispatch `
--json databaseId,conclusion,status `
--jq '.[] | select (.status == "pending") | select (.conclusion == "") | .databaseId'
if ($? -and $null -ne $databaseId -and $databaseId -match '^\d+$' -and
[int64] $databaseId -ne 0
) {
gh run cancel $databaseId
}
env:
GH_TOKEN: ${{ github.token }}

0 comments on commit 05b77c6

Please sign in to comment.