Skip to content

Commit

Permalink
Fix jq's select
Browse files Browse the repository at this point in the history
  • Loading branch information
spetrosi committed Aug 2, 2024
1 parent 19e9dfd commit f5afd5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tft_citest_bad.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
PR_TITLE: ${{ github.event.issue.title }}
run: |
PENDING_RUN=$(gh api "repos/$REPO/actions/workflows/tft.yml/runs?event=issue_comment" \
| jq -r '[.workflow_runs[] | select(.display_title="$PR_TITLE") | select(.status == "pending" or .status == "queued" or .status == "in_progress") | .id][0]')
| jq -r "[.workflow_runs[] | select( .display_title == \"$PR_TITLE\") | select(.status == "pending" or .status == "queued" or .status == "in_progress") | .id][0]")
if [ "$PENDING_RUN" = "null" ]; then # if pending run don't exist, take the last run with failure state
RUN_ID=$(gh api "repos/$REPO/actions/workflows/tft.yml/runs?event=issue_comment" \
| jq -r '[.workflow_runs[] | select( .conclusion == "failure" ) | select ( .display_title="$PR_TITLE" ) | .id][0]')
| 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
Expand Down

0 comments on commit f5afd5a

Please sign in to comment.