Repository navigation
Add forge pr checks command - #179
Open
CloudCorpRecords wants to merge 3 commits into
Open
CloudCorpRecords wants to merge 3 commits into
CloudCorpRecords wants to merge 3 commits into
Conversation
Shows CI check status for a pull request, like 'gh pr checks'. Resolves the PR by number or from the current branch, then lists commit statuses for the PR's head commit and CI pipeline runs for the head branch (filtered to the head commit). Fixes git-pkgs#112. Signed-off-by: Rene Turcios <95189389+CloudCorpRecords@users.noreply.github.com>
andrew
requested changes
Oct 19, 2026
andrew
left a comment
Contributor
There was a problem hiding this comment.
Please address these three points:
- In
internal/cli/pr_checks.go:65-88, GitHub check runs are never fetched.CommitStatuses().Listreads legacy statuses, whileCI().ListRunsreads Actions workflow runs. Third-party checks are omitted, and individual Actions jobs collapse into one workflow result. Add check-run retrieval and tests covering checks that are absent from both existing sources. - In
internal/cli/pr_checks.go:97, failed or pending checks still return exit code 0 because the command returns only the printing result. The existing happy-path test includes a failed status and expects success. Return appropriate nonzero exit codes for failed and pending checks, and test those outcomes through command execution. - In
internal/cli/pr_checks.go:138, plain output drops the conclusion, so successful and failed workflows both showcompleted. Print the conclusion when available, as table output does, and cover successful and failed runs in plain-output tests.
Autopilot mechanical merge (conflicts resolved: none) Signed-off-by: Rene Turcios <95189389+CloudCorpRecords@users.noreply.github.com>
Implements maintainer review feedback on the pr checks command: - Fetch GitHub check runs (Checks API) for the head commit in addition to legacy commit statuses and Actions workflow runs, covering third-party checks and individual jobs. New CheckRuns service on the Forge interface; GitHub backend implemented, other backends return ErrNotSupported. - Return exit code 1 when any check failed and 2 when no check failed but some are pending. cmd/forge maps exit-carrying errors to the process exit status. - Plain output now prints the run conclusion (e.g. success, failure) instead of a bare status, matching the table output. Signed-off-by: Rene Turcios <95189389+CloudCorpRecords@users.noreply.github.com>
andrew
requested changes
Oct 20, 2026
andrew
left a comment
Contributor
There was a problem hiding this comment.
The three earlier points are addressed, thanks. Two problems are blocking:
- The merge commit 27a1b49 has current main as a parent, but its tree drops main's changes. Merging this PR would revert #172 (
release upload --tag), #180 (non-nil upload options) and #181 (client-side--headfilter for Gitea/Forgejo). That's the deletions ingitea/prs.go,gitea/prs_test.go,github/releases.go,github/releases_test.go,internal/cli/release.goandinternal/cli/release_test.go. CI stays green only because the tests went with the code. Please rebase onto main, or redo the merge so main's side is kept. prChecksExitErrorclassifies every commit status returned. GitHub'sListStatusesand Gitea'sListStatusesboth return the full history for a ref. So a context that postedpendingand thensuccesskeeps both entries, the stalependingmakes the command exit nonzero forever, and the table shows duplicate rows. Keep only the newest status perContext(byCreatedAt) before printing and classifying, and add a command-level test with a pending-then-success pair for one context.
Two smaller ones:
- gh exits 8 for pending checks. Please use 8 instead of 2 for
prChecksExitPendingso scripts written againstgh pr checksbehave the same, and update the help text. - In
printPRChecksthe "Checks for #N ..." header is printed before theoutput.Plainbranch, so plain output starts with a line that isn't tab-separated. Other commands print only data lines in plain mode. Move the header below the plain branch.
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.
Adds a new
forge pr checks [<number>]command, an exact copy ofgh pr checks,as requested in #112.
(same resolution path as
pr view).CommitStatuses().List.CI().ListRuns,filtered client-side to the head commit.
ErrNotSupported); returnsa clean "checks are not supported by this forge" error when neither is
supported (e.g. Bitbucket); skips CI runs for full-ref heads such as
refs/pull/<n>/head(Gitea/Forgejo AGit PRs).--output table(default, two labeled sections),--output plain,--output json({pr, commit_statuses, ci_runs}).This also answers the open question in the issue: Gitea/Forgejo do support this
through the existing backend abstractions,
CommitStatuses.ListandCI.ListRunsare both implemented there andHead.SHAis populated.Fixes #112.
Evidence
go build ./..., OKgo vet ./internal/cli/, clean;gofmt, cleango test -count=1 -race ./..., all 12 packages passinternal/cli/pr_checks_test.go: registration, arg validation,happy path (head-SHA status query, branch CI query, SHA filtering drops stale
runs), unsupported-forge error, full-ref head skips CI, JSON output,
filterCIRunsForSHAunit testHonest limits
--watch/--fail-fastflags (gh has them), left as follow-up scope.doesn't implement CI listing.
environment); CI's lint job is the backstop.