Documentation
¶
Overview ¶
Package post submits approved review findings back to the upstream hosting service as inline PR review comments.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Poster ¶
type Poster struct {
// Out receives dry-run payloads and the resulting Review URL on submit.
Out io.Writer
// Repost, when true, bypasses the pre-post dedup step that skips
// findings whose (file, line) already has a diffsmith thread on the
// MR/PR. Use this for the explicit "I know there are duplicates and
// I want them anyway" path; the default behavior is to skip.
Repost bool
}
Poster submits approved review findings to GitHub as inline PR review comments grouped under a single Review.
func (*Poster) PrintPayload ¶
PrintPayload writes the addPullRequestReviewThread input as one JSON document per finding to p.Out — a hermetic preview of what Submit would send. The review ID is a placeholder ("<REVIEW_ID>") because the pending review only exists after a real submit.
func (*Poster) Submit ¶
func (p *Poster) Submit(ctx context.Context, target review.ReviewTarget, findings []review.Finding) error
Submit runs the four-phase GraphQL flow that turns approved findings into a single grouped GitHub Review:
- Resolve the PR's GraphQL node ID from (owner, repo, number).
- Begin a pending pull request review.
- Add one inline thread per finding, anchored to (path, line, HeadSHA).
- Finalize: submit if ≥1 thread succeeded; otherwise delete the pending review so it doesn't strand on GitHub.
Per-finding addThread failures do NOT abort the batch — every finding is attempted, then a summary is printed and the appropriate finalize call runs. This keeps GitHub state consistent: callers either see a real review URL (with a summary that names any failed findings) or a clean error after the pending review has been swept away.