prdiff

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 7 Imported by: 0

README

prdiff GoDoc Go Report Card

prdiff enumerates GitHub Pull Requests merged into default branch since last release (or between two branches/commits/tags)

Installation

go get -u github.com/storz/prdiff/cmd/prdiff

# if couldn't find any packages because of you are inside $GOPATH
GO111MODULE=on go get -u github.com/storz/prdiff/cmd/prdiff

Usage

prdiff [[base] head]
prdiff [base...head]
Arguments
base   begin point of diff (default: latest release)
head   end point of diff (default: default branch set on GitHub)
Options
  -o, --owner string    user/organization name (default: repository of current directory)
  -r, --repo string     repository name (default: repository of current directory)
  -t, --target string   specified target branch what you want to get diff (default: default branch set on GitHub)
      --token string    GitHub access token (default: $GITHUB_TOKEN)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(gh *GitHub, owner, repo, defaultBranch string) *prdiff

New initializes prdiff command to keep GitHub client and some settings.

func NewClosedPullRequestListOptions

func NewClosedPullRequestListOptions(opts ...PullRequestListOptionFunc) *github.PullRequestListOptions

NewClosedPullRequestListOptions generates *github.PullRequestListOptions for fetching closed utmost count PRs with update time desc.

Types

type GitHub

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

GitHub manages GitHub API client from google/go-github.

func NewGitHub

func NewGitHub(ctx context.Context, accessToken string) *GitHub

NewGitHub returns `GitHub` with OAuth access token of github.com.

func (*GitHub) CompareRepositoryCommits

func (gh *GitHub) CompareRepositoryCommits(ctx context.Context, owner, repo, base, head string) (*github.CommitsComparison, *github.Response, error)

CompareRepositoryCommits calls `Repositories.CompareCommits`.

func (*GitHub) GetRepository

func (gh *GitHub) GetRepository(ctx context.Context, owner, repo string) (*github.Repository, *github.Response, error)

GetRepository calls `Repositories.Get`.

func (*GitHub) GetRepositoryLatestRelease

func (gh *GitHub) GetRepositoryLatestRelease(ctx context.Context, owner, repo string) (*github.RepositoryRelease, *github.Response, error)

GetRepositoryLatestRelease calls `Repositories.GetLatestRelease`.

func (*GitHub) ListPullRequests

func (gh *GitHub) ListPullRequests(ctx context.Context, owner, repo string, opt *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error)

ListPullRequests calls `PullRequests.List`.

type GitHubAPI

type GitHubAPI interface {
	GetRepository(ctx context.Context, owner, repo string) (*github.Repository, *github.Response, error)
	GetRepositoryLatestRelease(ctx context.Context, owner, repo string) (*github.RepositoryRelease, *github.Response, error)
	ListPullRequests(ctx context.Context, owner, repo string, opt *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error)
	CompareRepositoryCommits(ctx context.Context, owner, repo, base, head string) (*github.CommitsComparison, *github.Response, error)
}

GitHubAPI represents required API calls for GitHub.

type PullRequestListOptionFunc

type PullRequestListOptionFunc func(*github.PullRequestListOptions)

PullRequestListOptionFunc represents functional option for generating *github.PullRequestListOptions

func WithBase

func WithBase(base string) PullRequestListOptionFunc

WithBase modifies Base field of *github.PullRequestListOptions.

Directories

Path Synopsis
cmd
prdiff command

Jump to

Keyboard shortcuts

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