pr

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BranchName

func BranchName(botIdentity, repoName, scheduleKey, fingerprint string) string

BranchName returns a deterministic branch name for remediation runs.

Types

type API

type API interface {
	EnsureHeadRef(ctx context.Context, owner, repo, headBranch, baseBranch string) error
	EnsureFileContent(ctx context.Context, owner, repo, branch, filePath, commitMessage string, content []byte) (bool, error)
	ListOpenByHead(ctx context.Context, owner, repo, headBranch, baseBranch string) ([]PullRequest, error)
	Create(ctx context.Context, owner, repo string, req CreateRequest) (PullRequest, error)
	Update(ctx context.Context, owner, repo string, number int, req UpdateRequest) (PullRequest, error)
}

API abstracts GitHub PR APIs for deterministic tests and retry behavior.

type CommentAPI added in v1.0.2

type CommentAPI interface {
	ListIssueComments(ctx context.Context, owner, repo string, issueNumber int) ([]IssueComment, error)
	CreateIssueComment(ctx context.Context, owner, repo string, issueNumber int, body string) (IssueComment, error)
	UpdateIssueComment(ctx context.Context, owner, repo string, commentID int, body string) (IssueComment, error)
}

CommentAPI abstracts issue comment APIs for deterministic PR comment upserts.

type CreateRequest

type CreateRequest struct {
	Title string `json:"title"`
	Head  string `json:"head"`
	Base  string `json:"base"`
	Body  string `json:"body"`
}

type GitHubClient

type GitHubClient struct {
	// contains filtered or unexported fields
}

func NewGitHubClient

func NewGitHubClient(baseURL, token string, client *http.Client) *GitHubClient

func (*GitHubClient) Create

func (c *GitHubClient) Create(ctx context.Context, owner, repo string, req CreateRequest) (PullRequest, error)

func (*GitHubClient) CreateIssueComment added in v1.0.2

func (c *GitHubClient) CreateIssueComment(ctx context.Context, owner, repo string, issueNumber int, body string) (IssueComment, error)

func (*GitHubClient) EnsureFileContent

func (c *GitHubClient) EnsureFileContent(ctx context.Context, owner, repo, branch, filePath, commitMessage string, content []byte) (bool, error)

func (*GitHubClient) EnsureHeadRef

func (c *GitHubClient) EnsureHeadRef(ctx context.Context, owner, repo, headBranch, baseBranch string) error

func (*GitHubClient) ListIssueComments added in v1.0.2

func (c *GitHubClient) ListIssueComments(ctx context.Context, owner, repo string, issueNumber int) ([]IssueComment, error)

func (*GitHubClient) ListOpenByHead

func (c *GitHubClient) ListOpenByHead(ctx context.Context, owner, repo, headBranch, baseBranch string) ([]PullRequest, error)

func (*GitHubClient) Update

func (c *GitHubClient) Update(ctx context.Context, owner, repo string, number int, req UpdateRequest) (PullRequest, error)

func (*GitHubClient) UpdateIssueComment added in v1.0.2

func (c *GitHubClient) UpdateIssueComment(ctx context.Context, owner, repo string, commentID int, body string) (IssueComment, error)

type IssueComment added in v1.0.2

type IssueComment struct {
	ID   int    `json:"id"`
	Body string `json:"body"`
}

IssueComment is a minimal deterministic PR comment contract.

type PullRequest

type PullRequest struct {
	Number int    `json:"number"`
	URL    string `json:"url"`
	Title  string `json:"title"`
	Body   string `json:"body"`
	Head   string `json:"head"`
	Base   string `json:"base"`
}

PullRequest is a minimal deterministic PR contract used by wrkr fix automation.

type UpdateRequest

type UpdateRequest struct {
	Title string `json:"title"`
	Body  string `json:"body"`
}

type UpsertInput

type UpsertInput struct {
	Owner       string
	Repo        string
	HeadBranch  string
	BaseBranch  string
	Title       string
	Body        string
	Fingerprint string
}

type UpsertIssueCommentInput added in v1.0.2

type UpsertIssueCommentInput struct {
	Owner       string
	Repo        string
	IssueNumber int
	Body        string
	Fingerprint string
}

type UpsertIssueCommentResult added in v1.0.2

type UpsertIssueCommentResult struct {
	Action  string       `json:"action"`
	Comment IssueComment `json:"comment"`
}

func UpsertIssueComment added in v1.0.2

type UpsertResult

type UpsertResult struct {
	Action      string      `json:"action"`
	PullRequest PullRequest `json:"pull_request"`
}

func Upsert

func Upsert(ctx context.Context, api API, in UpsertInput) (UpsertResult, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL