github

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGitHubTokenNotFound = errors.New("GitHub token not found: use --use-gh-auth flag or set GITHUB_TOKEN or GH_TOKEN environment variable")
	ErrGHNotInstalled      = errors.New("'gh' command not found in PATH")
	ErrGHAuthFailed        = errors.New("failed to get token from 'gh auth token'")
	ErrGHAuthEmptyToken    = errors.New("'gh auth token' returned empty output")
)

Functions

func SplitRepo

func SplitRepo(repo string) (string, string)

Types

type GQLAssociatedPRs

type GQLAssociatedPRs struct {
	Nodes []GQLPRNode `json:"nodes"`
}

type GQLAuthor

type GQLAuthor struct {
	Login string `json:"login"`
}

type GQLClient

type GQLClient struct {
	Token string
	Cl    *github.Client
	// contains filtered or unexported fields
}

func NewGQLClient added in v1.3.0

func NewGQLClient(useGHAuth bool) (*GQLClient, error)

NewGQLClient creates a new GitHub GraphQL client with flexible authentication. Uses priority cascade: --use-gh-auth flag → GITHUB_TOKEN → GITHUB_API_TOKEN → GH_TOKEN → interactive prompt.

func (GQLClient) CommitByRef

func (c GQLClient) CommitByRef(repo, tag string) (string, error)

func (GQLClient) HistoryGraphQl

func (c GQLClient) HistoryGraphQl(repo, branch, commitLimit string) ([]GQLCommit, error)

func (GQLClient) ReleaseGraphQL

func (c GQLClient) ReleaseGraphQL(repo string) ([]GQLRelease, error)

func (GQLClient) UpsertRelease

func (c GQLClient) UpsertRelease(
	ctx context.Context,
	repo string,
	releaseName string,
	tagName string,
	contentModifier func(repositoryRelease *github.RepositoryRelease) error,
) error

type GQLCommit

type GQLCommit struct {
	Oid                    string           `json:"oid"`
	Message                string           `json:"message,omitempty"`
	AssociatedPullRequests GQLAssociatedPRs `json:"associatedPullRequests,omitempty"`
}

type GQLData

type GQLData struct {
	Repository GQLRepo `json:"repository"`
}

type GQLHistoryRepo

type GQLHistoryRepo struct {
	PageInfo GQLPageInfo `json:"pageInfo"`
	Nodes    []GQLCommit `json:"nodes"`
}

type GQLObjectRelease

type GQLObjectRelease struct {
	Nodes    []GQLRelease `json:"nodes"`
	PageInfo GQLPageInfo  `json:"pageInfo"`
}

type GQLObjectRepo

type GQLObjectRepo struct {
	History GQLHistoryRepo `json:"history"`
}

type GQLOutput

type GQLOutput struct {
	Data GQLData `json:"data"`
}

type GQLPRNode

type GQLPRNode struct {
	Author      GQLAuthor `json:"author"`
	Number      int       `json:"number"`
	Title       string    `json:"title"`
	Body        string    `json:"body"`
	Merged      bool      `json:"merged"`
	MergeCommit GQLCommit `json:"mergeCommit"`
}

type GQLPageInfo

type GQLPageInfo struct {
	HasNextPage bool   `json:"hasNextPage"`
	EndCursor   string `json:"endCursor"`
}

type GQLRef

type GQLRef struct {
	Target GQLRefTarget `json:"target"`
}

type GQLRefTarget

type GQLRefTarget struct {
	CommitUrl string `json:"commitUrl"`
	Oid       string `json:"oid"`
}

func (GQLRefTarget) Commit added in v0.7.0

func (r GQLRefTarget) Commit() string

type GQLRelease

type GQLRelease struct {
	Name         string    `json:"name"`
	CreatedAt    time.Time `json:"createdAt"`
	PublishedAt  time.Time `json:"publishedAt"`
	IsDraft      bool      `json:"isDraft"`
	IsPrerelease bool      `json:"isPrerelease"`
	Description  string    `json:"description"`
	Id           int       `json:"databaseId"`
	IsLatest     bool      `json:"isLatest"`
}

func (GQLRelease) Branch added in v0.6.0

func (r GQLRelease) Branch() string

Branch branch that this release was first on

func (GQLRelease) ExtractReleaseDate added in v0.6.0

func (r GQLRelease) ExtractReleaseDate() (time.Time, error)

ExtractReleaseDate returns the date this was published, if there's a `> Released on YYYY/MM/DD` in the description it uses this, otherwise it uses the PublishedAt data from Github.

func (GQLRelease) IsLTS added in v0.11.0

func (r GQLRelease) IsLTS() bool

func (GQLRelease) IsReleased added in v0.6.0

func (r GQLRelease) IsReleased() bool

IsReleased returns if the release in not prerelease not a draft

func (GQLRelease) SemVer added in v0.10.0

func (r GQLRelease) SemVer() *semver.Version

type GQLRepo

type GQLRepo struct {
	Ref      GQLRef           `json:"ref"`
	Object   GQLObjectRepo    `json:"object"`
	Releases GQLObjectRelease `json:"releases"`
}

Jump to

Keyboard shortcuts

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