-
Notifications
You must be signed in to change notification settings - Fork 815
Fail viable/strict update when no green commit found #16650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ad5f97d
3853086
2b6260c
377f503
768cfa3
427c297
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,7 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||
| environment: ${{ (github.event_name == 'schedule') && 'update-viable-strict' || '' }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Update viable/strict | ||||||||||||||||||||||||||||||||||||||||||||||||||
| id: update | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: pytorch/test-infra/.github/actions/update-viablestrict@main | ||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| repository: pytorch/executorch | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -25,3 +26,93 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||
| clickhouse-url: ${{ secrets.CLICKHOUSE_URL }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| clickhouse-username: ${{ secrets.CLICKHOUSE_VIABLESTRICT_USERNAME }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| clickhouse-password: ${{ secrets.CLICKHOUSE_VIABLESTRICT_PASSWORD }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Summarize CI failures | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if: steps.update.outputs.latest_viable_sha == 'None' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "## ❌ No green commit found" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "viable/strict branch was not updated because no commit passed all required checks." >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "### Failures by commit (recent)" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # Get commits between viable/strict and main using GitHub API | ||||||||||||||||||||||||||||||||||||||||||||||||||
| VIABLE_SHA=$(gh api repos/pytorch/executorch/git/ref/heads/viable/strict --jq '.object.sha' 2>/dev/null || echo "") | ||||||||||||||||||||||||||||||||||||||||||||||||||
| MAIN_SHA=$(gh api repos/pytorch/executorch/git/ref/heads/main --jq '.object.sha' 2>/dev/null || echo "") | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| found_failures=false | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "$VIABLE_SHA" ] && [ -n "$MAIN_SHA" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # Get commits between viable/strict and main (up to 20) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # Use ASCII unit separator (0x1f) to avoid issues with special chars in names | ||||||||||||||||||||||||||||||||||||||||||||||||||
| COMMITS=$(gh api "repos/pytorch/executorch/compare/${VIABLE_SHA}...${MAIN_SHA}" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| --jq '.commits | reverse | .[:20] | .[] | "\(.sha)\u001f\(.commit.message | split("\n")[0] | .[:50])"' 2>/dev/null || echo "") | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "$COMMITS" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "| Commit | Title | Failed Job |" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "|--------|-------|------------|" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| while IFS=$'\x1f' read -r sha title; do | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| [ -z "$sha" ] && continue | ||||||||||||||||||||||||||||||||||||||||||||||||||
| short_sha="${sha:0:7}" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # Sanitize title for markdown table | ||||||||||||||||||||||||||||||||||||||||||||||||||
| title=$(echo "$title" | tr '|' '-') | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # Get workflow runs for this commit (use unit separator) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| failed_run=$(gh api "repos/pytorch/executorch/actions/runs?head_sha=${sha}&per_page=100" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| --jq '.workflow_runs[] | select(.conclusion == "failure") | "\(.id)\u001f\(.name)"' 2>/dev/null | head -1) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "$failed_run" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||
| IFS=$'\x1f' read -r run_id workflow_name <<< "$failed_run" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # Sanitize workflow name for markdown table | ||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow_name=$(echo "$workflow_name" | tr '|' '-') | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # Get failed job name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| failed_job=$(gh api "repos/pytorch/executorch/actions/runs/${run_id}/jobs?per_page=100" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| --jq '.jobs[] | select(.conclusion == "failure") | .name' 2>/dev/null | head -1 | tr '|' '-') | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+75
to
+76
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "| ${short_sha} | ${title} | ${workflow_name} / ${failed_job:-unknown} |" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
| found_failures=true | ||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||
| done <<< "$COMMITS" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "$found_failures" = false ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # Fallback: show recent failed runs from main branch only | ||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "> Note: Could not determine commits between branches. Showing recent failures from main branch." >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "| Commit | Title | Failed Job |" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "|--------|-------|------------|" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # Filter by branch=main and use unit separator | ||||||||||||||||||||||||||||||||||||||||||||||||||
| gh api "repos/pytorch/executorch/actions/runs?branch=main&per_page=20" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| --jq '.workflow_runs[] | select(.conclusion == "failure") | "\(.id)\u001f\(.head_sha | .[:7])\u001f\(.display_title | .[:50])\u001f\(.name)"' 2>/dev/null | \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| while IFS=$'\x1f' read -r run_id sha title workflow; do | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # Sanitize for markdown table | ||||||||||||||||||||||||||||||||||||||||||||||||||
| title=$(echo "$title" | tr '|' '-') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow=$(echo "$workflow" | tr '|' '-') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| failed_job=$(gh api "repos/pytorch/executorch/actions/runs/${run_id}/jobs?per_page=100" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| --jq '.jobs[] | select(.conclusion == "failure") | .name' 2>/dev/null | head -1 | tr '|' '-') | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+95
to
+100
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| while IFS=$'\x1f' read -r run_id sha title workflow; do | |
| # Sanitize for markdown table | |
| title=$(echo "$title" | tr '|' '-') | |
| workflow=$(echo "$workflow" | tr '|' '-') | |
| failed_job=$(gh api "repos/pytorch/executorch/actions/runs/${run_id}/jobs?per_page=100" \ | |
| --jq '.jobs[] | select(.conclusion == "failure") | .name' 2>/dev/null | head -1 | tr '|' '-') | |
| sanitize_md() { | |
| local input="$1" | |
| # Replace table separators and escape other markdown-special characters | |
| input=${input//|/-} | |
| input=${input//\`/\'} | |
| input=${input//\[/\\[} | |
| input=${input//]/\\]} | |
| input=${input//*/\\*} | |
| input=${input//_/\\_} | |
| printf '%s' "$input" | |
| } | |
| while IFS=$'\x1f' read -r run_id sha title workflow; do | |
| # Sanitize for markdown table | |
| title=$(sanitize_md "$title") | |
| workflow=$(sanitize_md "$workflow") | |
| failed_job=$(gh api "repos/pytorch/executorch/actions/runs/${run_id}/jobs?per_page=100" \ | |
| --jq '.jobs[] | select(.conclusion == "failure") | .name' 2>/dev/null | head -1) | |
| failed_job=$(sanitize_md "$failed_job") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The string comparison
== 'None'suggests the output is the literal string 'None' rather than an empty string or null. This is an unusual pattern for GitHub Actions outputs. Consider verifying this matches the actual output format from the upstream action, or use a more conventional empty check like== ''if appropriate.