pr

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 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 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) 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) 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)

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 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