Documentation
¶
Index ¶
- func SanitizeBranchSegment(s string) string
- type Author
- type Client
- func (c *Client) CreateBranchFromMain(ctx context.Context, branchName string) (err error)
- func (c *Client) CreatePR(ctx context.Context, branch, title, body string) (url string, err error)
- func (c *Client) GetFileContent(ctx context.Context, path string) (content []byte, sha string, err error)
- func (c *Client) UpdateFile(ctx context.Context, branch, path string, content []byte, ...) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SanitizeBranchSegment ¶
SanitizeBranchSegment lowercases input and replaces any non [a-z0-9-_] run with a single hyphen, trimming leading/trailing hyphens.
Types ¶
type Author ¶
Author identifies the commit author the bot writes as.
func DefaultAuthor ¶
func DefaultAuthor() Author
DefaultAuthor returns the noreply-style author used when no override is configured.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(appID, installationID int64, privateKey []byte, owner, repo string, author Author) (*Client, error)
NewClient creates a GitHub client authenticated as a GitHub App installation. Outbound HTTP is wrapped with otelhttp for distributed trace propagation. A zero-value Author falls back to DefaultAuthor().
func (*Client) CreateBranchFromMain ¶
CreateBranchFromMain creates a branch from the current HEAD of main, replacing an existing branch with the same name when present.
func (*Client) CreatePR ¶
CreatePR opens a pull request from branch into main and returns its HTML URL.