github

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package github provides a client for interacting with the GitHub API to create/update pull requests and commits.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides methods to interact with the GitHub API for creating/updating pull requests and commits.

func NewClient

func NewClient(ctx context.Context, token, ownerRepo string) (*Client, error)

NewClient creates a new GitHub API client using the provided token and repository information.

func (*Client) CommitAndPush

func (c *Client) CommitAndPush(ctx context.Context, branch, message string, files []string) error

CommitAndPush creates a new commit with the given message and files on the specified branch, then pushes it to GitHub. If the branch does not exist, it will be created. If the branch already exists and has the same tree SHA as the new commit, no action is taken.

func (*Client) EnsurePR

func (c *Client) EnsurePR(ctx context.Context, branchName, title, body string) (int, string, error)

EnsurePR creates a new pull request with the given branch, title, and body, or updates the title and body if an open PR already exists for the branch. It returns the PR number and URL.

Jump to

Keyboard shortcuts

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