|
16 | 16 | environment: ${{ (github.event_name == 'schedule') && 'update-viable-strict' || '' }} |
17 | 17 | steps: |
18 | 18 | - name: Update viable/strict |
| 19 | + id: update |
19 | 20 | uses: pytorch/test-infra/.github/actions/update-viablestrict@main |
20 | 21 | with: |
21 | 22 | repository: pytorch/executorch |
|
25 | 26 | clickhouse-url: ${{ secrets.CLICKHOUSE_URL }} |
26 | 27 | clickhouse-username: ${{ secrets.CLICKHOUSE_VIABLESTRICT_USERNAME }} |
27 | 28 | clickhouse-password: ${{ secrets.CLICKHOUSE_VIABLESTRICT_PASSWORD }} |
| 29 | + |
| 30 | + - name: Summarize CI failures |
| 31 | + if: steps.update.outputs.latest_viable_sha == 'None' |
| 32 | + env: |
| 33 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + run: | |
| 35 | + echo "## ❌ No green commit found" >> $GITHUB_STEP_SUMMARY |
| 36 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 37 | + echo "viable/strict branch was not updated because no commit passed all required checks." >> $GITHUB_STEP_SUMMARY |
| 38 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 39 | +
|
| 40 | + echo "### Failures by commit (recent)" >> $GITHUB_STEP_SUMMARY |
| 41 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 42 | +
|
| 43 | + # Get commits between viable/strict and main using GitHub API |
| 44 | + VIABLE_SHA=$(gh api repos/pytorch/executorch/git/ref/heads/viable/strict --jq '.object.sha' 2>/dev/null || echo "") |
| 45 | + MAIN_SHA=$(gh api repos/pytorch/executorch/git/ref/heads/main --jq '.object.sha' 2>/dev/null || echo "") |
| 46 | +
|
| 47 | + found_failures=false |
| 48 | +
|
| 49 | + if [ -n "$VIABLE_SHA" ] && [ -n "$MAIN_SHA" ]; then |
| 50 | + # Get commits between viable/strict and main (up to 20) |
| 51 | + # Use ASCII unit separator (0x1f) to avoid issues with special chars in names |
| 52 | + COMMITS=$(gh api "repos/pytorch/executorch/compare/${VIABLE_SHA}...${MAIN_SHA}" \ |
| 53 | + --jq '.commits | reverse | .[:20] | .[] | "\(.sha)\u001f\(.commit.message | split("\n")[0] | .[:50])"' 2>/dev/null || echo "") |
| 54 | +
|
| 55 | + if [ -n "$COMMITS" ]; then |
| 56 | + echo "| Commit | Title | Failed Job |" >> $GITHUB_STEP_SUMMARY |
| 57 | + echo "|--------|-------|------------|" >> $GITHUB_STEP_SUMMARY |
| 58 | +
|
| 59 | + while IFS=$'\x1f' read -r sha title; do |
| 60 | + [ -z "$sha" ] && continue |
| 61 | + short_sha="${sha:0:7}" |
| 62 | + # Sanitize title for markdown table |
| 63 | + title=$(echo "$title" | tr '|' '-') |
| 64 | +
|
| 65 | + # Get workflow runs for this commit (use unit separator) |
| 66 | + failed_run=$(gh api "repos/pytorch/executorch/actions/runs?head_sha=${sha}&per_page=100" \ |
| 67 | + --jq '.workflow_runs[] | select(.conclusion == "failure") | "\(.id)\u001f\(.name)"' 2>/dev/null | head -1) |
| 68 | +
|
| 69 | + if [ -n "$failed_run" ]; then |
| 70 | + IFS=$'\x1f' read -r run_id workflow_name <<< "$failed_run" |
| 71 | + # Sanitize workflow name for markdown table |
| 72 | + workflow_name=$(echo "$workflow_name" | tr '|' '-') |
| 73 | +
|
| 74 | + # Get failed job name |
| 75 | + failed_job=$(gh api "repos/pytorch/executorch/actions/runs/${run_id}/jobs?per_page=100" \ |
| 76 | + --jq '.jobs[] | select(.conclusion == "failure") | .name' 2>/dev/null | head -1 | tr '|' '-') |
| 77 | +
|
| 78 | + echo "| ${short_sha} | ${title} | ${workflow_name} / ${failed_job:-unknown} |" >> $GITHUB_STEP_SUMMARY |
| 79 | + found_failures=true |
| 80 | + fi |
| 81 | + done <<< "$COMMITS" |
| 82 | + fi |
| 83 | + fi |
| 84 | +
|
| 85 | + if [ "$found_failures" = false ]; then |
| 86 | + # Fallback: show recent failed runs from main branch only |
| 87 | + echo "> Note: Could not determine commits between branches. Showing recent failures from main branch." >> $GITHUB_STEP_SUMMARY |
| 88 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 89 | + echo "| Commit | Title | Failed Job |" >> $GITHUB_STEP_SUMMARY |
| 90 | + echo "|--------|-------|------------|" >> $GITHUB_STEP_SUMMARY |
| 91 | +
|
| 92 | + # Filter by branch=main and use unit separator |
| 93 | + gh api "repos/pytorch/executorch/actions/runs?branch=main&per_page=20" \ |
| 94 | + --jq '.workflow_runs[] | select(.conclusion == "failure") | "\(.id)\u001f\(.head_sha | .[:7])\u001f\(.display_title | .[:50])\u001f\(.name)"' 2>/dev/null | \ |
| 95 | + while IFS=$'\x1f' read -r run_id sha title workflow; do |
| 96 | + # Sanitize for markdown table |
| 97 | + title=$(echo "$title" | tr '|' '-') |
| 98 | + workflow=$(echo "$workflow" | tr '|' '-') |
| 99 | + failed_job=$(gh api "repos/pytorch/executorch/actions/runs/${run_id}/jobs?per_page=100" \ |
| 100 | + --jq '.jobs[] | select(.conclusion == "failure") | .name' 2>/dev/null | head -1 | tr '|' '-') |
| 101 | + if [ -n "$failed_job" ]; then |
| 102 | + echo "| ${sha} | ${title} | ${workflow} / ${failed_job} |" >> $GITHUB_STEP_SUMMARY |
| 103 | + fi |
| 104 | + done |
| 105 | + fi |
| 106 | +
|
| 107 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 108 | + echo "### Summary by job (main branch, last 24h)" >> $GITHUB_STEP_SUMMARY |
| 109 | + echo '```' >> $GITHUB_STEP_SUMMARY |
| 110 | + # Filter by main branch and created in last 24 hours (GNU date syntax for Ubuntu runner) |
| 111 | + yesterday=$(date -u -d '24 hours ago' '+%Y-%m-%dT%H:%M:%SZ') |
| 112 | + gh api "repos/pytorch/executorch/actions/runs?branch=main&created=>${yesterday}&per_page=100" \ |
| 113 | + --jq '.workflow_runs[] | select(.conclusion == "failure") | .name' 2>/dev/null \ |
| 114 | + | sort | uniq -c | sort -rn | head -10 >> $GITHUB_STEP_SUMMARY || echo "Failed to fetch data" >> $GITHUB_STEP_SUMMARY |
| 115 | + echo '```' >> $GITHUB_STEP_SUMMARY |
| 116 | +
|
| 117 | + echo "::error::No green commit found - viable/strict was not updated" |
| 118 | + exit 1 |
0 commit comments