Documentation ¶
Index ¶
- Constants
- Variables
- func AddToKnownHosts(ctx context.Context)
- type Check
- type GitHub
- func (g *GitHub) AddComment(pullRequestNum int, msg string) error
- func (g *GitHub) AddLabel(pullRequestNum int, newLabel string) error
- func (g *GitHub) ClosePullRequest(pullRequestNum int) (*github.PullRequest, error)
- func (g *GitHub) CreatePullRequest(title, baseBranch, headBranch, body string) (*github.PullRequest, error)
- func (g *GitHub) CreateReference(repoOwner, repoName, ref, sha string) error
- func (g *GitHub) DeleteReference(repoOwner, repoName, ref string) error
- func (g *GitHub) GetAuthenticatedUser() (*github.User, error)
- func (g *GitHub) GetChecks(ref string) ([]*Check, error)
- func (g *GitHub) GetDescription(pullRequestNum int) (string, error)
- func (g *GitHub) GetFullHistoryUrl(userEmail string) string
- func (g *GitHub) GetIssueUrlBase() string
- func (g *GitHub) GetIssues(open bool, labels []string, maxResults int) ([]*github.Issue, error)
- func (g *GitHub) GetLabels(pullRequestNum int) ([]string, error)
- func (g *GitHub) GetPullRequest(pullRequestNum int) (*github.PullRequest, error)
- func (g *GitHub) GetPullRequestUrlBase() string
- func (g *GitHub) GetReference(repoOwner, repoName, ref string) (*github.Reference, error)
- func (g *GitHub) ListMatchingReferences(repoOwner, repoName, ref string) ([]*github.Reference, error)
- func (g *GitHub) ListOpenPullRequests() ([]*github.PullRequest, error)
- func (g *GitHub) MergePullRequest(pullRequestNum int, msg, mergeMethod string) error
- func (g *GitHub) ReRequestLatestCheckSuite(ref string) error
- func (g *GitHub) ReadRawFile(branch, filePath string) (string, error)
- func (g *GitHub) RemoveLabel(pullRequestNum int, oldLabel string) error
- func (g *GitHub) ReplaceLabel(pullRequestNum int, oldLabel, newLabel string) error
Constants ¶
const ( GITHUB_TOKEN_METADATA_KEY = "github_token" GITHUB_TOKEN_FILENAME = "github_token" GITHUB_TOKEN_SERVER_PATH = "/var/secrets/github-token" SSH_KEY_FILENAME = "id_rsa" SSH_KEY_SERVER_PATH = "/var/secrets/ssh-key" MERGE_METHOD_SQUASH = "squash" MERGE_METHOD_REBASE = "rebase" MERGEABLE_STATE_DIRTY = "dirty" // Merge conflict. MERGEABLE_STATE_CLEAN = "clean" // No conflicts. MERGEABLE_STATE_UNKNOWN = "unknown" // Mergeablility was not checked yet. MERGEABLE_STATE_UNSTABLE = "unstable" // Failing or pending commit status. AUTOSUBMIT_LABEL = "autosubmit" CHECK_STATE_SUCCESS = "success" CHECK_STATE_CANCELLED = "cancelled" CHECK_STATE_FAILURE = "failure" CHECK_STATE_NEUTRAL = "neutral" CHECK_STATE_TIMED_OUT = "timed_out" CHECK_STATE_ACTION_REQUIRED = "action_required" CHECK_STATE_ERROR = "error" CHECK_STATE_PENDING = "pending" // Known checks. CLA_CHECK = "cla/google" IMPORT_COPYBARA_CHECK = "import/copybara" )
Variables ¶
var ( OPEN_STATE = "open" CLOSED_STATE = "closed" )
Functions ¶
func AddToKnownHosts ¶
AddToKnownHosts adds github.com to .ssh/known_hosts. Without this, interactions with github do not work.
Types ¶
type GitHub ¶
GitHub is used for iteracting with the GitHub API.
func NewGitHub ¶
func NewGitHub(ctx context.Context, repoOwner, repoName string, httpClient *http.Client) (*GitHub, error)
NewGitHub returns a new GitHub instance.
func (*GitHub) AddComment ¶
See https://developer.github.com/v3/issues/comments/#create-a-comment for the API documentation.
func (*GitHub) AddLabel ¶
See https://developer.github.com/v3/issues/#edit-an-issue for the API documentation.
func (*GitHub) ClosePullRequest ¶
func (g *GitHub) ClosePullRequest(pullRequestNum int) (*github.PullRequest, error)
See https://developer.github.com/v3/pulls/#update-a-pull-request for the API documentation.
func (*GitHub) CreatePullRequest ¶
func (g *GitHub) CreatePullRequest(title, baseBranch, headBranch, body string) (*github.PullRequest, error)
See https://developer.github.com/v3/pulls/#create-a-pull-request for the API documentation.
func (*GitHub) CreateReference ¶
See https://developer.github.com/v3/git/refs/#create-a-reference for the API documentation.
func (*GitHub) DeleteReference ¶
See https://developer.github.com/v3/git/refs/#delete-a-reference for the API documentation.
func (*GitHub) GetAuthenticatedUser ¶
See https://developer.github.com/v3/users/#get-the-authenticated-user for the API documentation.
func (*GitHub) GetChecks ¶
See https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref and https://developer.github.com/v3/repos/commits/#get-a-single-commit for the API documentation. Note: This combines checks from both ListCheckRunsForRef and GetCombinedStatus.
For flutter/engine on 12/2/19 GetCombinedStatus returned luci-engine and sign-cla.
TODO(rmistry): Use only Checks API when Flutter is moved completely to it.
func (*GitHub) GetDescription ¶
See https://developer.github.com/v3/issues/#get-a-single-issue for the API documentation.
func (*GitHub) GetFullHistoryUrl ¶
func (*GitHub) GetIssueUrlBase ¶
func (*GitHub) GetIssues ¶
See https://developer.github.com/v3/issues/#list-repository-issues for the API documentation.
func (*GitHub) GetLabels ¶
See https://developer.github.com/v3/issues/#get-a-single-issue for the API documentation.
func (*GitHub) GetPullRequest ¶
func (g *GitHub) GetPullRequest(pullRequestNum int) (*github.PullRequest, error)
See https://developer.github.com/v3/pulls/#get-a-single-pull-request for the API documentation.
func (*GitHub) GetPullRequestUrlBase ¶
func (*GitHub) GetReference ¶
See https://developer.github.com/v3/git/refs/#get-a-reference for the API documentation.
func (*GitHub) ListMatchingReferences ¶
func (g *GitHub) ListMatchingReferences(repoOwner, repoName, ref string) ([]*github.Reference, error)
See https://developer.github.com/v3/git/refs/#list-matching-references for the API documentation.
func (*GitHub) ListOpenPullRequests ¶
func (g *GitHub) ListOpenPullRequests() ([]*github.PullRequest, error)
See https://developer.github.com/v3/pulls/#list-pull-requests for the API documentation.
func (*GitHub) MergePullRequest ¶
See https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button for the API documentation.
func (*GitHub) ReRequestLatestCheckSuite ¶
See https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-specific-ref and https://developer.github.com/v3/checks/suites/#rerequest-check-suite for the API documentation.
func (*GitHub) RemoveLabel ¶
See https://developer.github.com/v3/issues/#edit-an-issue for the API documentation.
func (*GitHub) ReplaceLabel ¶
See https://developer.github.com/v3/issues/#edit-an-issue for the API documentation. Note: This adds the newLabel even if the oldLabel is not found.