github

package
v0.7.15 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsResolutionError

func IsResolutionError(err error) bool

IsResolutionError checks if an error is a repo resolution error.

Types

type Author

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

Author holds a GitHub user login.

type Client

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

Client is a GitHub GraphQL API client.

func New

func New() (*Client, error)

New creates a GitHub GraphQL client. It reads GITHUB_TOKEN and GITHUB_API_URL from the environment.

func (*Client) CheckRateLimit

func (c *Client) CheckRateLimit(ctx context.Context) error

CheckRateLimit queries the current rate limit status.

func (*Client) FetchOrgRepos

func (c *Client) FetchOrgRepos(ctx context.Context, org string, filterRepos []string) ([]string, error)

FetchOrgRepos returns repository names for the given org. If filterRepos is non-empty, those names are returned directly without querying.

func (*Client) FetchReviewActivity

func (c *Client) FetchReviewActivity(ctx context.Context, org, repo string, since time.Time) (*FetchReviewActivityResult, error)

FetchReviewActivity fetches review activity for a single repo. Returns an error containing "Could not resolve" for repos that don't exist.

func (*Client) ValidateOrg

func (c *Client) ValidateOrg(ctx context.Context, org string) error

ValidateOrg checks that the org is accessible.

type CommentNode

type CommentNode struct {
	Author    *Author `json:"author"`
	Body      string  `json:"body"`
	DiffHunk  string  `json:"diffHunk"`
	CreatedAt string  `json:"createdAt"`
}

CommentNode is a single review thread comment.

type FetchReviewActivityResult

type FetchReviewActivityResult struct {
	Activity map[string]*UserActivity
	Details  []ReviewCommentDetail
}

FetchReviewActivityResult holds the results of fetching review activity.

type OrgReposData

type OrgReposData struct {
	Organization struct {
		Repositories struct {
			PageInfo PageInfo   `json:"pageInfo"`
			Nodes    []RepoNode `json:"nodes"`
		} `json:"repositories"`
	} `json:"organization"`
	RateLimit RateLimit `json:"rateLimit"`
}

OrgReposData is the unwrapped data from the org repos query.

type PRNode

type PRNode struct {
	Number    int     `json:"number"`
	Title     string  `json:"title"`
	URL       string  `json:"url"`
	State     string  `json:"state"`
	UpdatedAt string  `json:"updatedAt"`
	Author    *Author `json:"author"`
	Reviews   struct {
		Nodes []ReviewNode `json:"nodes"`
	} `json:"reviews"`
	ReviewThreads struct {
		Nodes []struct {
			Comments struct {
				Nodes []CommentNode `json:"nodes"`
			} `json:"comments"`
		} `json:"nodes"`
	} `json:"reviewThreads"`
}

PRNode is a single pull request from the review activity query.

type PageInfo

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

PageInfo holds GraphQL pagination info.

type RateLimit

type RateLimit struct {
	Remaining int    `json:"remaining"`
	ResetAt   string `json:"resetAt"`
}

RateLimit holds GitHub GraphQL rate limit info.

type RepoNode

type RepoNode struct {
	Name string `json:"name"`
}

RepoNode is a single repository from the org repos query.

type RepoPRsData

type RepoPRsData struct {
	Repository *struct {
		PullRequests struct {
			PageInfo PageInfo `json:"pageInfo"`
			Nodes    []PRNode `json:"nodes"`
		} `json:"pullRequests"`
	} `json:"repository"`
	RateLimit RateLimit `json:"rateLimit"`
}

RepoPRsData is the unwrapped data from the review activity query.

type ReviewCommentDetail

type ReviewCommentDetail struct {
	Reviewer  string                `json:"reviewer"`
	Body      string                `json:"body"`
	DiffHunk  string                `json:"diffHunk"`
	CreatedAt string                `json:"createdAt"`
	PR        ReviewCommentDetailPR `json:"pr"`
}

ReviewCommentDetail is an enriched comment with PR metadata.

type ReviewCommentDetailPR

type ReviewCommentDetailPR struct {
	Repo   string `json:"repo"`
	Number int    `json:"number"`
	Title  string `json:"title"`
	Author string `json:"author"`
	URL    string `json:"url"`
	State  string `json:"state"`
}

ReviewCommentDetailPR holds PR metadata for a comment.

type ReviewNode

type ReviewNode struct {
	Author    *Author `json:"author"`
	State     string  `json:"state"`
	CreatedAt string  `json:"createdAt"`
}

ReviewNode is a single review on a PR.

type UserActivity

type UserActivity struct {
	Login            string
	TotalActivity    int
	ReviewsGiven     int
	Approvals        int
	ChangesRequested int
	ReviewComments   int
	ReposActiveIn    map[string]bool
}

UserActivity tracks review activity counts for a single user.

Jump to

Keyboard shortcuts

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