github

package
v0.0.0-...-b44c02a Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package github provides a wrapper around the go-github client for interacting with the GitHub API.

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 encapsulates the GitHub API client and repository context.

func NewClient

func NewClient(ctx context.Context, token, repoFullName string, interval time.Duration) (*Client, error)

NewClient creates a new GitHub client for specific repository. token is the GitHub Personal Access Token. repoFullName is the repository in "owner/repo" format.

func (*Client) AddLabel

func (c *Client) AddLabel(ctx context.Context, number int, labels []string) error

AddLabel adds labels to an issue

func (*Client) CloseIssue

func (c *Client) CloseIssue(ctx context.Context, number int) error

CloseIssue closes an issue

func (*Client) CommentOnIssue

func (c *Client) CommentOnIssue(ctx context.Context, number int, body string) error

CommentOnIssue adds a comment to an issue

func (*Client) CreateIssue

func (c *Client) CreateIssue(ctx context.Context, title, body string, labels []string) (*github.Issue, error)

CreateIssue creates a new issue in the repository.

func (*Client) DeleteBranch

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

DeleteBranch deletes a branch in the repository

func (*Client) DeleteFile

func (c *Client) DeleteFile(ctx context.Context, path, message string) error

DeleteFile deletes a file from the repository

func (*Client) GetFileContent

func (c *Client) GetFileContent(ctx context.Context, path string) (string, error)

GetFileContent reads a file from the repository (default branch)

func (*Client) GetIssueContent

func (c *Client) GetIssueContent(ctx context.Context, number int) (string, error)

GetIssueContent returns the body of a specific issue

func (*Client) GetPR

func (c *Client) GetPR(ctx context.Context, number int) (*github.PullRequest, error)

GetPR returns a PR to get its Head SHA

func (*Client) GetPRStatus

func (c *Client) GetPRStatus(ctx context.Context, ref string) (string, error)

GetPRStatus checks the combined status of a Ref (Head SHA of PR)

func (*Client) ListFiles

func (c *Client) ListFiles(ctx context.Context, path string) ([]string, error)

ListFiles returns a list of files in a directory

func (*Client) ListOpenIssuesByLabel

func (c *Client) ListOpenIssuesByLabel(ctx context.Context, label string) ([]*github.Issue, error)

ListOpenIssuesByLabel returns all open issues with the given label

func (*Client) ListOpenPullRequests

func (c *Client) ListOpenPullRequests(ctx context.Context) ([]*github.PullRequest, error)

ListOpenPullRequests returns all open pull requests

func (*Client) MergePR

func (c *Client) MergePR(ctx context.Context, number int) error

MergePR merges a pull request

func (*Client) SpecHasGapAnalysis

func (c *Client) SpecHasGapAnalysis(ctx context.Context, specID int, gapLabel string) bool

SpecHasGapAnalysis checks if a Spec #ID has a corresponding Gap Analysis issue

type ClientInterface

type ClientInterface interface {
	ListOpenIssuesByLabel(ctx context.Context, label string) ([]*github.Issue, error)
	ListOpenPullRequests(ctx context.Context) ([]*github.PullRequest, error)
	CreateIssue(ctx context.Context, title, body string, labels []string) (*github.Issue, error)
	AddLabel(ctx context.Context, number int, labels []string) error
	SpecHasGapAnalysis(ctx context.Context, specID int, gapLabel string) bool
	GetIssueContent(ctx context.Context, number int) (string, error)
	CommentOnIssue(ctx context.Context, number int, body string) error
	CloseIssue(ctx context.Context, number int) error
	MergePR(ctx context.Context, number int) error
	GetPRStatus(ctx context.Context, ref string) (string, error)
	GetPR(ctx context.Context, number int) (*github.PullRequest, error)
	GetFileContent(ctx context.Context, path string) (string, error)
	ListFiles(ctx context.Context, path string) ([]string, error)
	DeleteBranch(ctx context.Context, branchName string) error
	DeleteFile(ctx context.Context, path, message string) error
}

ClientInterface defines the methods required for interacting with GitHub. This interface allows for mocking in tests.

Jump to

Keyboard shortcuts

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