ghutils

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MPL-2.0 Imports: 9 Imported by: 0

README

GitHub Utilities

Stefan Arentz, July 2023

Work in progress. This is a collection of functions that work together with github.com/google/go-github. There is not a lot of documentation yet - the best way to get started is to look at the tests.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IterateOrgRepos

func IterateOrgRepos(ctx context.Context, client *github.Client, org string, opts *github.RepositoryListByOrgOptions, f IterRepoFunc) error

func IterateRepoCommits

func IterateRepoCommits(client *github.Client, ctx context.Context, owner string, repo string, opts *github.CommitsListOptions, f IterateCommitFunc) error

func IterateRepoIssues

func IterateRepoIssues(ctx context.Context, client *github.Client, owner string, repo string, opts *github.IssueListByRepoOptions, f IterateIssueFunc) error

func IterateRepoPullRequests

func IterateRepoPullRequests(ctx context.Context, client *github.Client, owner string, repo string, opts *github.PullRequestListOptions, f IteratePullRequestFunc) error

func IterateRepoReleases

func IterateRepoReleases(client *github.Client, ctx context.Context, owner string, repo string, opts *github.ListOptions, f IterateReleaseFunc) error

func IterateRepositoryWorkflowRuns

func IterateRepositoryWorkflowRuns(ctx context.Context, client *github.Client, owner string, repo string, opts *github.ListWorkflowRunsOptions, f IterateWorkflowRunsFunc) error

func ListAllReposByOrg

func ListAllReposByOrg(ctx context.Context, client *github.Client, org string, opts *github.RepositoryListByOrgOptions) ([]*github.Repository, error)

func MapOrgRepos

func MapOrgRepos[T any](ctx context.Context, client *github.Client, org string, opts *github.RepositoryListByOrgOptions, mapper MapRepoFunc[T]) ([]T, error)

func MapRepoCommits

func MapRepoCommits[T any](client *github.Client, ctx context.Context, owner string, repo string, opts *github.CommitsListOptions, mapper MapCommitFunc[T]) ([]T, error)

func MapRepoIssues

func MapRepoIssues[T any](ctx context.Context, client *github.Client, owner string, repo string, opts *github.IssueListByRepoOptions, mapper MapIssueFunc[T]) ([]T, error)

func MapRepoPullRequests

func MapRepoPullRequests[T any](ctx context.Context, client *github.Client, owner string, repo string, opts *github.PullRequestListOptions, mapper MapPullRequestFunc[T]) ([]T, error)

func MapRepos

func MapRepos[T any](ctx context.Context, client *github.Client, repos []string, mapper MapRepoFunc[T]) ([]T, error)

func NewClient

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

func NewTokenFromEnvironment

func NewTokenFromEnvironment() (string, error)

func ReduceOrgRepos

func ReduceOrgRepos[A any](ctx context.Context, client *github.Client, org string, opts *github.RepositoryListByOrgOptions, initial A, reducer ReduceRepoFunc[A]) (A, error)

func ReduceRepoCommits

func ReduceRepoCommits[A any](client *github.Client, ctx context.Context, owner string, repo string, opts *github.CommitsListOptions, initial A, reducer ReduceCommitFunc[A]) (A, error)

func ReduceRepoIssues

func ReduceRepoIssues[A any](ctx context.Context, client *github.Client, org string, repo string, opts *github.IssueListByRepoOptions, initial A, reducer ReduceIssueFunc[A]) (A, error)

func ReduceRepoPullRequests

func ReduceRepoPullRequests[A any](ctx context.Context, client *github.Client, org string, repo string, opts *github.PullRequestListOptions, initial A, reducer ReducePullRequestFunc[A]) (A, error)

func ReduceRepos

func ReduceRepos[A any](ctx context.Context, client *github.Client, repos []string, initial A, reducer ReduceRepoFunc[A]) (A, error)

func SplitFullRepoName

func SplitFullRepoName(fullName string) (string, string, error)

Types

type IterRepoFunc

type IterRepoFunc func(commit *github.Repository) (bool, error)

type IterateCommitFunc

type IterateCommitFunc func(commit *github.RepositoryCommit) (bool, error)

type IterateIssueFunc

type IterateIssueFunc func(commit *github.Issue) (bool, error)

type IteratePullRequestFunc

type IteratePullRequestFunc func(commit *github.PullRequest) (bool, error)

type IterateReleaseFunc

type IterateReleaseFunc func(release *github.RepositoryRelease) (bool, error)

type IterateWorkflowJobFunc

type IterateWorkflowJobFunc func(job *github.WorkflowJob) (bool, error)

type IterateWorkflowRunsFunc

type IterateWorkflowRunsFunc func(run *github.WorkflowRun) (bool, error)

type MapCommitFunc

type MapCommitFunc[T any] func(commit *github.RepositoryCommit) (T, bool, error)

type MapIssueFunc

type MapIssueFunc[T any] func(commit *github.Issue) (T, bool, error)

type MapPullRequestFunc

type MapPullRequestFunc[T any] func(commit *github.PullRequest) (T, bool, error)

type MapRepoFunc

type MapRepoFunc[T any] func(repo *github.Repository) (T, bool, error)

type ReduceCommitFunc

type ReduceCommitFunc[A any] func(acc A, commit *github.RepositoryCommit) (A, bool, error)

type ReduceIssueFunc

type ReduceIssueFunc[A any] func(acc A, repo *github.Issue) (A, bool, error)

type ReducePullRequestFunc

type ReducePullRequestFunc[A any] func(acc A, repo *github.PullRequest) (A, bool, error)

type ReduceRepoFunc

type ReduceRepoFunc[A any] func(acc A, repo *github.Repository) (A, bool, error)

Jump to

Keyboard shortcuts

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