Documentation
¶
Index ¶
- func IsExecution(err error) bool
- func IsInstallationNotFound(err error) bool
- func IsInvalidConfig(err error) bool
- func IsNotFound(err error) bool
- func IsPRMergeTimeout(err error) bool
- func NewConditional(config Config) (*Client, *Conditional, error)
- type Client
- func (c *Client) AddRepoToRenovatePermissions(ctx context.Context, org string, repo *github.Repository) error
- func (c *Client) CheckRunsForRef(ctx context.Context, owner, repo, ref string) ([]*github.CheckRun, error)
- func (c *Client) CloneRepository(ctx context.Context, owner, repo, workDir string) error
- func (c *Client) CommitAndPush(ctx context.Context, owner, repo, branch, message string) error
- func (c *Client) CommitStatuses(ctx context.Context, owner, repo, ref string) ([]*github.RepoStatus, error)
- func (c *Client) CreateBranch(ctx context.Context, newBranch string) error
- func (c *Client) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo, newOwner string, ...) (*github.Repository, error)
- func (c *Client) CreatePullRequest(ctx context.Context, owner, repo, head, title string) (*github.PullRequest, error)
- func (c *Client) FileExists(ctx context.Context, owner, repo, path, ref string) (bool, error)
- func (c *Client) GetFile(ctx context.Context, owner, repo, path, ref string) (RepositoryFile, error)
- func (c *Client) GetRepository(ctx context.Context, owner, repo string) (*github.Repository, error)
- func (c *Client) GetUnderlyingClient(ctx context.Context) *github.Client
- func (c *Client) ListRepositories(ctx context.Context, owner string) ([]Repository, error)
- func (c *Client) PullRequest(ctx context.Context, owner, repo string, number int) (*github.PullRequest, error)
- func (c *Client) RemoveRepoFromRenovatePermissions(ctx context.Context, org string, repo *github.Repository) error
- func (c *Client) RemoveRepositoryBranchProtection(ctx context.Context, repository *github.Repository) (err error)
- func (c *Client) ReportedChecks(ctx context.Context, repository *github.Repository, branch string) ([]string, error)
- func (c *Client) RequiredStatusContexts(ctx context.Context, owner, repo, branch string) ([]string, error)
- func (c *Client) SetRepositoryBranchProtection(ctx context.Context, repository *github.Repository, checkNames []string, ...) (err error)
- func (c *Client) SetRepositoryDefaultBranch(ctx context.Context, repository *github.Repository, newDefaultBranch string) (err error)
- func (c *Client) SetRepositoryPermissions(ctx context.Context, repository *github.Repository, ...) error
- func (c *Client) SetRepositorySettings(ctx context.Context, repository, repositorySettings *github.Repository) (*github.Repository, error)
- func (c *Client) SetRepositoryWebhooks(ctx context.Context, repository *github.Repository, hook *github.Hook) error
- func (c *Client) WaitForPRMerge(ctx context.Context, owner, repo string, prNumber int, timeout time.Duration) error
- func (c *Client) WorkflowRunsForSHA(ctx context.Context, owner, repo, sha string) ([]*github.WorkflowRun, error)
- type Conditional
- type Config
- type RateLimit
- type Repository
- type RepositoryFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInstallationNotFound ¶
IsInstallationNotFound asserts installationNotFoundError.
func IsInvalidConfig ¶
IsInvalidConfig asserts invalidConfigError.
func IsPRMergeTimeout ¶
IsPRMergeTimeout asserts prMergeTimeoutError.
func NewConditional ¶ added in v8.79.0
func NewConditional(config Config) (*Client, *Conditional, error)
NewConditional is New for a poll loop: every GET is a conditional request through a Conditional, whose Rate the caller reads for its interval. The client is read-only in practice (DryRun is not applied) and config.BaseURL is used as given, with no /api/v3/ suffix: it names the REST API root itself (api.github.com, or a test double serving /repos/... at its root).
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddRepoToRenovatePermissions ¶
func (c *Client) AddRepoToRenovatePermissions(ctx context.Context, org string, repo *github.Repository) error
Add repository to the Renovate installation. Corresponds to https://docs.github.com/en/rest/apps/installations?apiVersion=2022-11-28#add-a-repository-to-an-app-installation
func (*Client) CheckRunsForRef ¶ added in v8.79.0
func (c *Client) CheckRunsForRef(ctx context.Context, owner, repo, ref string) ([]*github.CheckRun, error)
CheckRunsForRef returns the check runs of ref as the merge box lists them: the latest run per check name and app (GitHub's filter=latest), every page.
func (*Client) CloneRepository ¶
func (*Client) CommitAndPush ¶
func (*Client) CommitStatuses ¶ added in v8.79.0
func (c *Client) CommitStatuses(ctx context.Context, owner, repo, ref string) ([]*github.RepoStatus, error)
CommitStatuses returns the commit statuses of ref, the latest per context (the combined status), every page.
func (*Client) CreateBranch ¶
func (*Client) CreateFromTemplate ¶
func (c *Client) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo, newOwner string, repository *github.Repository) (*github.Repository, error)
func (*Client) CreatePullRequest ¶
func (*Client) FileExists ¶ added in v8.79.0
FileExists says whether path is a file at ref.
func (*Client) GetRepository ¶
func (*Client) GetUnderlyingClient ¶
GetUnderlyingClient returns the underlying go-github client.
func (*Client) ListRepositories ¶
func (*Client) PullRequest ¶ added in v8.79.0
func (c *Client) PullRequest(ctx context.Context, owner, repo string, number int) (*github.PullRequest, error)
PullRequest returns the pull request as GitHub sees it now: state, draft, mergeable state, head and base.
func (*Client) RemoveRepoFromRenovatePermissions ¶
func (c *Client) RemoveRepoFromRenovatePermissions(ctx context.Context, org string, repo *github.Repository) error
Remove repository from the Renovate installation. Corresponds to https://docs.github.com/en/rest/apps/installations?apiVersion=2022-11-28#remove-a-repository-from-an-app-installation
func (*Client) RemoveRepositoryBranchProtection ¶
func (*Client) ReportedChecks ¶ added in v8.49.0
func (c *Client) ReportedChecks(ctx context.Context, repository *github.Repository, branch string) ([]string, error)
ReportedChecks returns the names of the commit status contexts and the completed, non-skipped check runs observed on the latest non-tag commit of branch and on the heads of the most recently merged pull requests: the checks that demonstrably run in this repository. Callers use it to require a check only once it exists (devctl repo checks --checks-if-reported).
func (*Client) RequiredStatusContexts ¶ added in v8.79.0
func (c *Client) RequiredStatusContexts(ctx context.Context, owner, repo, branch string) ([]string, error)
RequiredStatusContexts returns the status contexts branch requires before a merge: the required status checks of its branch protection and of every ruleset in effect on it, sorted and without duplicates. A protection the token may not read (404: none, or 403: no admin access) contributes nothing; the rules endpoint answers for everyone with read access.
func (*Client) SetRepositoryBranchProtection ¶
func (*Client) SetRepositoryDefaultBranch ¶
func (*Client) SetRepositoryPermissions ¶
func (*Client) SetRepositorySettings ¶
func (c *Client) SetRepositorySettings(ctx context.Context, repository, repositorySettings *github.Repository) (*github.Repository, error)
func (*Client) SetRepositoryWebhooks ¶
func (*Client) WaitForPRMerge ¶
func (*Client) WorkflowRunsForSHA ¶ added in v8.79.0
func (c *Client) WorkflowRunsForSHA(ctx context.Context, owner, repo, sha string) ([]*github.WorkflowRun, error)
WorkflowRunsForSHA returns every GitHub Actions run of the head SHA, whatever its status, every page.
type Conditional ¶ added in v8.79.0
type Conditional struct {
// Base sends the requests; nil means http.DefaultTransport.
Base http.RoundTripper
// contains filtered or unexported fields
}
Conditional is an http.RoundTripper that makes every GET a conditional request: it keeps the ETag and body of the last 200 per URL, sends the tag as If-None-Match and replays the kept body when GitHub answers 304 Not Modified. A 304 does not count against the rate limit, so a poll loop that sees no change costs nothing; go-github never sees the 304, it reads a 200 with the same body as before.
It also remembers the rate-limit headers of the newest answer, 304 or not, so a poll loop derives its interval from real responses and never asks the rate_limit endpoint.
func (*Conditional) Rate ¶ added in v8.79.0
func (c *Conditional) Rate() RateLimit
Rate is the budget the newest response reported.
func (*Conditional) Replayed ¶ added in v8.79.0
func (c *Conditional) Replayed() int
Replayed is how many 304 answers were replayed from the cache.
type RateLimit ¶ added in v8.79.0
type RateLimit struct {
// Known is false before the first response with rate-limit headers.
Known bool
Remaining int
Reset time.Time
}
RateLimit is what the newest response said about the budget.