Documentation
¶
Index ¶
- Variables
- func IsNotFound(err error) bool
- type Client
- func (c *Client) CheckSyncStatus(ctx context.Context, repo string) (bool, error)
- func (c *Client) CheckTeam(ctx context.Context, owner, team string) error
- func (c *Client) CompareSyncState(ctx context.Context, repo string) (SyncState, error)
- func (c *Client) CreateReleaseBranch(ctx context.Context, repo, branchName string) error
- func (c *Client) CreateReleasePR(ctx context.Context, repo, branchName, version string) (string, error)
- func (c *Client) CreateSyncPR(ctx context.Context, repo string) (string, error)
- func (c *Client) DetectBranches(ctx context.Context, repo string) (base string, dev string, err error)
- func (c *Client) FetchRepos(ctx context.Context) ([]string, error)
- func (c *Client) FindOpenSyncPR(ctx context.Context, repo string) (string, error)
- func (c *Client) GetLatestReleaseTag(ctx context.Context, repo string) (string, error)
- func (c *Client) LatestRelease(ctx context.Context, repo string) (ReleaseInfo, error)
- func (c *Client) ResolveOwner(ctx context.Context, owner string) (config.OwnerType, error)
- type ReleaseInfo
- type SyncState
Constants ¶
This section is empty.
Variables ¶
var ErrSyncPRExists = errors.New("sync pull request already exists")
ErrSyncPRExists reports that the sync pull request the caller asked for is already open, so nothing was created.
Functions ¶
func IsNotFound ¶ added in v1.2.0
IsNotFound reports whether an API call failed with 404. Auto-sync uses it to tell "this repository does not follow the base/dev model" apart from a real failure, since comparing against a branch that does not exist returns 404.
Types ¶
type Client ¶
Client wraps the GitHub API for a single rel profile.
func NewClient ¶
NewClient builds an authenticated client bound to the given profile. The profile may be nil for calls that only need to inspect an owner (for example the setup wizard).
func (*Client) CheckSyncStatus ¶
CheckSyncStatus reports whether the base branch is ahead of the dev branch.
func (*Client) CompareSyncState ¶ added in v1.2.0
CompareSyncState compares the dev branch against the base branch. Everything it returns comes from a single compare call, so callers get the divergence details for free.
func (*Client) CreateReleaseBranch ¶
CreateReleaseBranch cuts a release branch from the dev branch.
func (*Client) CreateReleasePR ¶
func (c *Client) CreateReleasePR(ctx context.Context, repo, branchName, version string) (string, error)
CreateReleasePR opens the release branch against the base branch.
func (*Client) CreateSyncPR ¶
CreateSyncPR opens a PR that merges the base branch back into the dev branch.
func (*Client) DetectBranches ¶
func (c *Client) DetectBranches(ctx context.Context, repo string) (base string, dev string, err error)
DetectBranches inspects a sample repository and suggests the base branch (its default branch) and the dev branch (the first well known dev-style branch that exists, otherwise the base branch).
func (*Client) FetchRepos ¶
FetchRepos lists the repositories the profile targets, applying its include and exclude filters. When a team is configured it is used first; if the team cannot be read (missing scope, wrong slug) it falls back to listing the whole owner so the tool stays usable.
func (*Client) FindOpenSyncPR ¶ added in v1.2.0
FindOpenSyncPR returns the URL of an already open base-to-dev pull request, or an empty string when there is none. It keeps repeated auto-sync runs from piling up duplicate pull requests.
func (*Client) GetLatestReleaseTag ¶
GetLatestReleaseTag returns the most recent tag of a repository.
func (*Client) LatestRelease ¶ added in v1.2.0
LatestRelease returns the newest published release of a repository. Draft releases are ignored because they are not visible to anyone but the author. Repositories that tag without publishing GitHub releases fall back to the newest tag, whose commit date is used as the publication time.
type ReleaseInfo ¶ added in v1.2.0
ReleaseInfo describes the most recent release marker of a repository. A zero value means the repository has never been released.
func (ReleaseInfo) Found ¶ added in v1.2.0
func (r ReleaseInfo) Found() bool
Found reports whether a release marker was actually resolved.
type SyncState ¶ added in v1.2.0
type SyncState struct {
// AheadBy counts commits the base branch has that the dev branch lacks.
AheadBy int
// BehindBy counts commits the dev branch has that the base branch lacks.
BehindBy int
// MergeBase is the date of the newest commit both branches share, which is
// effectively the moment they were last in sync.
MergeBase time.Time
}
SyncState describes how a repository's base and development branches relate.