github

package
v0.0.0-...-f513b22 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SanitizeBranchSegment

func SanitizeBranchSegment(s string) string

SanitizeBranchSegment lowercases input and replaces any non [a-z0-9-_] run with a single hyphen, trimming leading/trailing hyphens.

Types

type Author

type Author struct {
	Name  string
	Email string
}

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

func (c *Client) CreateBranchFromMain(ctx context.Context, branchName string) (err error)

CreateBranchFromMain creates a branch from the current HEAD of main, replacing an existing branch with the same name when present.

func (*Client) CreatePR

func (c *Client) CreatePR(ctx context.Context, branch, title, body string) (url string, err error)

CreatePR opens a pull request from branch into main and returns its HTML URL.

func (*Client) GetFileContent

func (c *Client) GetFileContent(ctx context.Context, path string) (content []byte, sha string, err error)

GetFileContent fetches a file from the default branch.

func (*Client) UpdateFile

func (c *Client) UpdateFile(ctx context.Context, branch, path string, content []byte, fileSHA, commitMsg string) (err error)

UpdateFile commits a file change on the given branch.

Jump to

Keyboard shortcuts

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