Skip to content

feat: add prw checks to list every check of a PR - #20

Merged
devblac merged 6 commits into
mainfrom
feat/checks-command
Oct 25, 2026
Merged

devblac merged 6 commits into
mainfrom
feat/checks-command

Conversation

@devblac

@devblac devblac commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Roadmap #12. prw checks <PR_URL> shows every check run and commit status of the PR's head commit with its result, duration and link — failures first.

owner/repo#123 — Add feature
abc1234 · failure · 1 fail, 1 pending, 3 pass · merge: blocked

❌ fail     Test (ubuntu-latest)  4m02s   https://github.com/owner/repo/actions/runs/…/job/…
⏳ pending  E2E                   1m10s…  https://github.com/owner/repo/actions/runs/…/job/…
✅ pass     Build                 45s     https://github.com/owner/repo/actions/runs/…/job/…
  • Buckets: fail, cancel, pending, pass, neutral, skipping (classified like the overall CI state).
  • Runs superseded by a newer run of the same check are hidden (github.LatestCheckRuns, now exported).
  • CheckRun gains started_at / completed_at for durations (running checks show elapsed time with …).
  • --json: object with checks: [{name, bucket, state, kind, url, started_at, completed_at}], plus overall state and merge_state.
  • Exit codes match prw wait (0 / 1 / 3 / 4) plus 8 while running, like gh pr checks.

Test plan

Stacked on #19.

🤖 Generated with Claude Code

devblac and others added 4 commits October 18, 2026 03:11
`prw run` now also tells you when a watched PR is approved, gets changes
requested, runs into merge conflicts, or becomes ready to merge after branch
protection, conflicts or an outdated branch were holding it back.

- Review decision from /pulls/{n}/reviews: each reviewer's latest approval or
  change request counts, comments don't, dismissals withdraw it. One extra
  request per PR per poll, a free 304 when nothing changed.
- Merge state from the PR's mergeable_state (already fetched); "unknown" while
  GitHub computes it keeps the last value.
- Quiet by design: nothing on the first check of a PR; "ready" is not sent
  with the CI or approval notification that caused it, nor for repositories
  without branch protection (unstable -> clean is just CI passing).
- Events carry a Kind; console, native, Slack/Discord ("Review:" / "Merge:")
  and generic webhooks ("pr_review_change" / "pr_merge_state_change") render
  them. --on fail keeps changes_requested and conflict, --on success approved
  and ready.
- `prw list` gains REVIEW and MERGE columns (review/merge in --json and MCP
  list_watched); `prw wait --json` and the MCP tools report merge_state.
- `prw config set pr_events false` turns it off.

Verified live: #12 ready, cli/cli#14727 blocked; a simulated
blocked -> ready notified once, ready -> blocked stayed silent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviews come oldest first, so the 3-page cap dropped the newest approvals,
change requests and dismissals on PRs with more than 300 reviews, and the
review state stayed stale. Pagination now runs to the last page, with a
100-page cap only as a runaway guard.

Addresses Codex review on #19.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`prw checks <PR_URL>` shows each check run and commit status of the PR's head
commit with its result, how long it took and a link: failures first, then
cancelled and running ones, then passed, neutral and skipped. Superseded runs
of the same check are left out, as they don't count towards the result. The
header has the short SHA, overall state, counts per bucket and merge state.
`--json` prints the same as an object with a `checks` array.

Exit codes match `prw wait` (0 passed, 1 failed, 3 error, 4 no CI), plus 8
while checks are still running, like `gh pr checks`.

Verified live on devblac/docker-lint#5, zephyrproject-rtos/zephyr#105183
(35 checks; the cancelled run superseded by a newer one is hidden) and
#13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T18:43:49.236248Z 9d6f230 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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.

Reviewed commit: 9d6f230797

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/prw/checks.go Outdated
Comment on lines +211 to +212
case "success", "merged", "closed":
return nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Return an error for PRs closed without merging

When a PR is closed without merging, fetchChecks replaces its CI result with "closed", and this branch then exits successfully—even if the listed checks failed or never ran. This contradicts the documented promise that exit codes match prw wait, whose waitResult.exitErr returns code 3 for this situation, and lets scripts using prw checks "$PR_URL" && ... proceed on an abandoned PR. Handle "closed" separately and return exitWaitError instead of success.

Useful? React with 👍 / 👎.

devblac and others added 2 commits October 24, 2026 15:58
It exited 0, so `prw checks "$PR" && ...` went ahead on an abandoned PR, and
the exit codes didn't match `prw wait` as documented.

Addresses Codex review on #20.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit only updated the README; this is the code change: a PR
closed without merging now exits 3 (like `prw wait`) instead of 0.

Addresses Codex review on #20.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@devblac
devblac changed the base branch from feat/review-merge-events to main October 25, 2026 00:16
@devblac
devblac merged commit 26b4159 into main Oct 25, 2026
@devblac
devblac deleted the feat/checks-command branch October 25, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant