Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PullRequest ¶ added in v0.11.0
type PullRequest struct {
// contains filtered or unexported fields
}
PullRequest is a comment and diff service for GitHub PullRequest.
API:
https://docs.github.com/en/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request POST /repos/:owner/:repo/pulls/:number/comments
func NewGitHubPullRequest ¶
func NewGitHubPullRequest(cli *github.Client, owner, repo string, pr int, sha, level string) (*PullRequest, error)
NewGitHubPullRequest returns a new PullRequest service. PullRequest service needs git command in $PATH.
The GitHub Token generated by GitHub Actions may not have the necessary permissions. For example, in the case of a PR from a forked repository, or when write permission is prohibited in the repository settings 1.
In such a case, the service will fallback to GitHub Actions workflow commands 2.
func (*PullRequest) Diff ¶ added in v0.11.0
func (g *PullRequest) Diff(ctx context.Context) ([]byte, error)
Diff returns a diff of PullRequest.
func (*PullRequest) Flush ¶ added in v0.11.0
func (g *PullRequest) Flush(ctx context.Context) error
Flush posts comments which has not been posted yet.
func (*PullRequest) Post ¶ added in v0.11.0
Post accepts a comment and holds it. Flush method actually posts comments to GitHub in parallel.
func (*PullRequest) Strip ¶ added in v0.11.0
func (g *PullRequest) Strip() int
Strip returns 1 as a strip of git diff.