Skip to content

Commit

Permalink
ci: Improve citest_bad script
Browse files Browse the repository at this point in the history
Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
  • Loading branch information
spetrosi committed Aug 2, 2024
1 parent 46df10e commit cfb72e0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/tft_citest_bad.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ jobs:
| jq -r "[.workflow_runs[] | select( .display_title == \"$PR_TITLE\") | \
select(.status == \"pending\" or .status == \"queued\" or .status == \"in_progress\") | .id][0]")
# if pending run don't exist, take the last run with failure state
if [ "$PENDING_RUN" = "null" ]; then
RUN_ID=$(gh api "repos/$REPO/actions/workflows/tft.yml/runs?event=issue_comment" \
| jq -r "[.workflow_runs[] | select( .display_title == \"$PR_TITLE\" ) | select( .conclusion == \"failure\" ) | .id][0]")
echo "Re-running workflow $RUN_ID"
gh api --method POST repos/$REPO/actions/runs/$RUN_ID/rerun-failed-jobs
else
if [ "$PENDING_RUN" != "null" ]; then
echo "The workflow $PENDING_RUN is still running, wait for it to finish to re-run"
exit 1
fi
RUN_ID=$(gh api "repos/$REPO/actions/workflows/tft.yml/runs?event=issue_comment" \
| jq -r "[.workflow_runs[] | select( .display_title == \"$PR_TITLE\" ) | select( .conclusion == \"failure\" ) | .id][0]")
if [ "$RUN_ID" = "null" ]; then
echo "Failed workflow not found, exitting"
exit 1
fi
echo "Re-running workflow $RUN_ID"
gh api --method POST repos/$REPO/actions/runs/$RUN_ID/rerun-failed-jobs

0 comments on commit cfb72e0

Please sign in to comment.