github

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentPR

func GetCurrentPR() (int, error)

GetCurrentPR auto-detects the PR number from the current branch using gh CLI

func GetToken

func GetToken() (string, error)

GetToken retrieves the GitHub token from GITHUB_TOKEN env var or gh CLI

func NewClient

func NewClient(ctx context.Context) (*github.Client, error)

NewClient creates a GitHub API client using GITHUB_TOKEN env var or gh CLI

func ParseOwnerRepo

func ParseOwnerRepo() (string, string, error)

ParseOwnerRepo extracts owner and repo from git remote origin

Types

type Annotation

type Annotation struct {
	Message         string
	Path            string
	StartLine       int
	Title           string
	AnnotationLevel string
}

Annotation represents a check run annotation (error/warning)

type CheckRunInfo

type CheckRunInfo struct {
	Name         string
	WorkflowName string
	Summary      string
	Status       string
	Conclusion   string
	StartedAt    *time.Time
	CompletedAt  *time.Time
	DetailsURL   string
	Annotations  []Annotation
}

CheckRunInfo contains enriched check run data with workflow name

func FetchCheckRunsGraphQL

func FetchCheckRunsGraphQL(ctx context.Context, token, owner, repo string, prNumber int) ([]CheckRunInfo, int, error)

FetchCheckRunsGraphQL fetches check runs with workflow names using GraphQL

type CheckRunsResult

type CheckRunsResult struct {
	CheckRuns          []*github.CheckRun
	RateLimitRemaining int
}

CheckRunsResult contains check runs and rate limit info

func FetchCheckRuns

func FetchCheckRuns(ctx context.Context, client *github.Client, owner, repo, sha string) (*CheckRunsResult, error)

FetchCheckRuns retrieves check runs for a given commit SHA

type PRInfo

type PRInfo struct {
	Number         int
	Title          string
	HeadSHA        string
	CreatedAt      string
	HeadCommitDate string
}

PRInfo contains metadata about a pull request

func FetchPRInfo

func FetchPRInfo(ctx context.Context, client *github.Client, owner, repo string, prNumber int) (*PRInfo, error)

FetchPRInfo retrieves metadata about a pull request

func GetCurrentPRFull

func GetCurrentPRFull() (*PRInfo, error)

GetCurrentPRFull uses gh CLI to get full PR info including branch

Jump to

Keyboard shortcuts

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