Skip to content

Commit a5d6ae4

Browse files
committed
Fix deflake workflow to use workflow ID
1 parent 3066759 commit a5d6ae4

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

.github/workflows/deflake_tests.yaml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222
env:
2323
DEFLAKE_ATTEMPTS: 3
2424
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25-
HEAD_REF: ${{ github.event.workflow_run.pull_requests[0].head.ref }}
26-
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
2725
WORKFLOW: ${{ github.event.workflow_run.id }}
2826
shell: bash
2927
run: |
@@ -39,23 +37,10 @@ jobs:
3937
if: steps.retry_check.outputs.continue == 'true'
4038
env:
4139
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
4340
REPO: ${{ github.repository }}
41+
WORKFLOW: ${{ github.event.workflow_run.id }}
4442
shell: bash
4543
run: |
4644
set +x
47-
echo "Fetching failing checks for PR #${PR_NUMBER}"
48-
# Fetch failing checks in JSON format
49-
failing_runs=$(gh pr checks "${PR_NUMBER}" --repo "${REPO}" --json url,conclusion --jq '.[] | select(.conclusion=="failure" or .conclusion=="cancelled") | .url')
50-
51-
if [ -z "${failing_runs}" ]; then
52-
echo "No failing checks found to rerun."
53-
exit 0
54-
fi
55-
56-
# Extract run IDs from URLs (assuming standard GitHub Actions URL format)
57-
run_ids=$(echo "$failing_runs" | grep -oP 'runs/\K\d+' | sort -u)
58-
59-
for run_id in $run_ids; do
60-
gh run rerun "$run_id" --repo "$REPO" --failed
61-
done
45+
echo "Rerunning failed jobs for workflow run ${WORKFLOW}"
46+
gh run rerun "${WORKFLOW}" --repo "${REPO}" --failed

0 commit comments

Comments
 (0)