github

package
v0.0.0-...-1eb392f Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForEachCandidatePRDo

func ForEachCandidatePRDo(client *github.Client, user, project string, fn PRFunction, once bool, config *FilterConfig) error

For each PR in the project that matches:

  • pr.Number > minPRNumber
  • is mergeable
  • has labels "cla: yes", "lgtm"
  • combinedStatus = 'success' (e.g. all hooks have finished success in github)

Run the specified function

func GetStatus

func GetStatus(client *github.Client, user, project string, prNumber int, requiredContexts []string) (string, error)

Gets the current status of a PR by introspecting the status of the commits in the PR. The rules are:

  • If any member of the 'requiredContexts' list is missing, it is 'incomplete'
  • If any commit is 'pending', the PR is 'pending'
  • If any commit is 'error', the PR is in 'error'
  • If any commit is 'failure', the PR is 'failure'
  • Otherwise the PR is 'success'

func MakeClient

func MakeClient(token string) *github.Client

func ValidateStatus

func ValidateStatus(client *github.Client, user, project string, prNumber int, requiredContexts []string, waitOnPending bool) (bool, error)

Make sure that the combined status for all commits in a PR is 'success' if 'waitForPending' is true, this function will wait until the PR is no longer pending (all checks have run)

func WaitForPending

func WaitForPending(client *github.Client, user, project string, prNumber int) error

Wait for a PR to move into Pending. This is useful because the request to test a PR again is asynchronous with the PR actually moving into a pending state TODO: add a timeout

Types

type FilterConfig

type FilterConfig struct {
	MinPRNumber            int
	UserWhitelist          []string
	WhitelistOverride      string
	RequiredStatusContexts []string
}

type PRFunction

type PRFunction func(*github.Client, *github.PullRequest, *github.Issue) error

Jump to

Keyboard shortcuts

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