github

package
v1.4.264 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

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
}

func NewClient

func NewClient(token, owner, repo string) *Client

func (*Client) FetchAllMergedPRs

func (c *Client) FetchAllMergedPRs(since time.Time) ([]*PR, error)

FetchAllMergedPRs fetches all merged PRs using GitHub's search API This is much more efficient than fetching PRs individually

func (*Client) FetchAllMergedPRsGraphQL

func (c *Client) FetchAllMergedPRsGraphQL(since time.Time) ([]*PR, error)

FetchAllMergedPRsGraphQL fetches all merged PRs with their commits using GraphQL This is the ultimate optimization - gets everything in ~5-10 API calls

func (*Client) FetchPRs

func (c *Client) FetchPRs(prNumbers []int) ([]*PR, error)

func (*Client) GetPRDetails added in v1.4.262

func (c *Client) GetPRDetails(prNumber int) (*PRDetails, error)

GetPRDetails fetches a comprehensive set of details for a single PR. Deprecated: Use GetPRValidationDetails + GetPRWithCommits for better performance

func (*Client) GetPRValidationDetails added in v1.4.262

func (c *Client) GetPRValidationDetails(prNumber int) (*PRDetails, error)

GetPRValidationDetails fetches only the data needed for validation (lightweight).

func (*Client) GetPRWithCommits added in v1.4.262

func (c *Client) GetPRWithCommits(prNumber int) (*PR, error)

GetPRWithCommits fetches the full PR and its commits.

type PR

type PR struct {
	Number      int
	Title       string
	Body        string
	Author      string
	AuthorURL   string
	AuthorType  string // "user", "organization", or "bot"
	URL         string
	MergedAt    time.Time
	Commits     []PRCommit
	MergeCommit string
}

type PRCommit

type PRCommit struct {
	SHA     string
	Message string
	Author  string
	Email   string    // Author email from GitHub API, empty if not public
	Date    time.Time // Timestamp field
	Parents []string  // Parent commits (for merge detection)
}

type PRDetails added in v1.4.262

type PRDetails struct {
	*PR
	State     string
	Mergeable bool
}

PRDetails encapsulates all relevant information about a Pull Request.

type PullRequestsQuery

type PullRequestsQuery struct {
	Repository struct {
		PullRequests struct {
			PageInfo struct {
				HasNextPage bool
				EndCursor   string
			}
			Nodes []struct {
				Number   int
				Title    string
				Body     string
				URL      string
				MergedAt time.Time
				Author   *struct {
					Typename string `graphql:"__typename"`
					Login    string `graphql:"login"`
					URL      string `graphql:"url"`
				}
				Commits struct {
					Nodes []struct {
						Commit struct {
							OID          string `graphql:"oid"`
							Message      string
							AuthoredDate time.Time `graphql:"authoredDate"`
							Author       struct {
								Name string
							}
						}
					}
				} `graphql:"commits(first: 250)"`
			}
		} `graphql:"pullRequests(first: 100, after: $after, states: MERGED, orderBy: {field: UPDATED_AT, direction: DESC})"`
	} `graphql:"repository(owner: $owner, name: $repo)"`
}

GraphQL query structures for hasura client

Jump to

Keyboard shortcuts

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