Enhance flaky job rerun summary with detailed logs for failed tests#3885
Open
Enhance flaky job rerun summary with detailed logs for failed tests#3885
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the .github/workflows/rerun-flaky-jobs.yml workflow so that when flakiness is detected (some jobs failed and some passed), the workflow summary includes per-failed-job excerpts intended to help diagnose failing tests.
Changes:
- Initializes a
FAILED_DETAILSvariable so the summary section can reference it unconditionally. - For each failed job, attempts to download job logs and extract
FAILED-block excerpts (capped) into a collapsible<details>section. - Appends a new “Failed test details” section to the
GITHUB_STEP_SUMMARYoutput when excerpts are present.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+235
to
+242
| done < <(echo "$JOBS_JSON" | jq -r ' | ||
| .jobs[] | ||
| | select(.conclusion != null and | ||
| (.conclusion == "failure" or | ||
| .conclusion == "cancelled" or | ||
| .conclusion == "timed_out")) | ||
| | [(.id | tostring), .name] | ||
| | @tsv') |
| else | ||
| FAILED_DETAILS="${FAILED_DETAILS} | ||
| <details> | ||
| <summary><b>${ESCAPED_JOB_NAME}</b> _(truncated — global size cap reached)_</summary> |
Comment on lines
+133
to
+140
| JOBS_JSON=$(gh api "repos/${{ github.repository }}/actions/runs/${RUN_ID}/attempts/${RUN_ATTEMPT}/jobs" 2>&1) | ||
| GH_STATUS=$? | ||
| if [ "$GH_STATUS" -ne 0 ]; then | ||
| echo "Error fetching jobs (exit code: $GH_STATUS)." >&2 | ||
| echo "$JOBS_JSON" >&2 | ||
| exit "$GH_STATUS" | ||
| fi | ||
|
|
Comment on lines
+212
to
+213
| CURRENT_SIZE=${#FAILED_DETAILS} | ||
| BLOCK_SIZE=${#JOB_BLOCK} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.