-
Notifications
You must be signed in to change notification settings - Fork 11
🤖 ci: improve extract_pr_logs to show in-progress job steps #476
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
base: main
Are you sure you want to change the base?
Conversation
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| # If --all flag is set or no failures, get latest run regardless of status | ||
| if [[ "$SHOW_ALL_JOBS" == true ]]; then | ||
| echo "🔍 Finding latest run for PR #$PR_NUMBER..." >&2 | ||
| RUN_ID=$(gh pr checks "$PR_NUMBER" --json name,link,state --jq '.[] | select(.link | contains("/runs/")) | .link' | head -1 | sed -E 's|.*/runs/([0-9]+).*|\1|' || echo "") | ||
| else | ||
| echo "🔍 Finding latest failed run for PR #$PR_NUMBER..." >&2 | ||
| # Get the latest failed run for this PR | ||
| RUN_ID=$(gh pr checks "$PR_NUMBER" --json name,link,state --jq '.[] | select(.state == "FAILURE") | select(.link | contains("/runs/")) | .link' | head -1 | sed -E 's|.*/runs/([0-9]+).*|\1|' || echo "") | ||
| fi | ||
|
|
||
| if [[ -z "$RUN_ID" ]]; then | ||
| echo "❌ No failed runs found for PR #$PR_NUMBER" >&2 |
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.
Fallback to pending runs never triggers
When invoked with a PR number and no --all flag, the script still looks exclusively for failed runs (select(.state == "FAILURE")) and immediately exits if none are found. This means a PR whose checks are only PENDING/IN_PROGRESS still returns “No failed runs found” and never reaches the new logic that should display step-by-step status for in-progress jobs. The commit message promises automatic handling of in-progress jobs, but that path is unreachable unless the user manually supplies --all or a run ID. Consider falling back to the latest run when no failures exist so the script can surface pending job steps as advertised.
Useful? React with 👍 / 👎.
a82674c to
8bae637
Compare
Shows step-by-step status for in-progress and pending jobs, making it much easier to debug CI runs that haven't completed yet. **Key improvements:** - Shows detailed step status (COMPLETED, IN_PROGRESS, PENDING) for jobs that are still running - Highlights which step is currently running - Provides direct link to view live logs in browser (GitHub API doesn't expose logs for in-progress jobs) - Automatically detects in-progress jobs when no failures exist - Simplified UX: removed --wait flag, pending jobs work automatically - New --all flag to show all jobs regardless of status - Better filtering logic to prioritize failed jobs, then in-progress jobs **Example output for in-progress job:** ``` 📊 Step-by-step status: [COMPLETED] Set up job (success) [COMPLETED] Checkout code (success) [IN_PROGRESS] Run /./.github/actions/setup-cmux [PENDING] Build application 🔄 Currently running: Run /./.github/actions/setup-cmux 👁️ View live logs: https://github.com/coder/cmux/actions/runs/.../job/... ``` _Generated with `cmux`_
c7f5837 to
508d4b4
Compare
Shows step-by-step status for in-progress and pending jobs, making it much easier to debug CI runs that haven't completed yet.
Key improvements:
Example output for in-progress job:
Limitation: GitHub's API doesn't provide actual log content for in-progress jobs - logs are only available once a job completes. The script now provides a direct link to view live logs in the browser instead.
Generated with
cmux