From 9629ab1859b016c76fc7b510bab0be8e93b3a54f Mon Sep 17 00:00:00 2001 From: Valentin Berlier Date: Sat, 17 Sep 2022 06:37:27 +0200 Subject: [PATCH] fix: try to cancel the main workflow repeatedly --- .github/workflows/template.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/template.yml b/.github/workflows/template.yml index 75cc0b6..97bdb95 100644 --- a/.github/workflows/template.yml +++ b/.github/workflows/template.yml @@ -62,6 +62,10 @@ jobs: git commit --amend -m "chore: setup project from template" git push -f origin HEAD - for id in $(gh api "/repos/$GH_REPOSITORY/actions/workflows/main.yml/runs?status=in_progress" | jq -r '.workflow_runs[].id'); do - gh api -XPOST "/repos/$GH_REPOSITORY/actions/runs/$id/cancel" + for i in {1..10}; do + for id in $(gh api "/repos/$GH_REPOSITORY/actions/workflows/main.yml/runs?status=in_progress" | jq -r '.workflow_runs[].id'); do + gh api -XPOST "/repos/$GH_REPOSITORY/actions/runs/$id/cancel" + exit 0 + done + sleep 3 done