{"modulePath":"github.com/gozeloglu/rel","version":"v1.3.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package github\n\n## Variables\n\n```go\nvar ErrHeadChanged = errors.New(\"pull request head changed since it was reviewed\")\n```\nErrHeadChanged reports that the pull request moved after it was reviewed, so GitHub declined to merge something the user has not seen.\n\n```go\nvar ErrMergeNotAllowed = errors.New(\"merge not allowed\")\n```\nErrMergeNotAllowed reports that GitHub refused the merge itself, which is what branch protection or a merge method disabled on the repository looks like from here.\n\n```go\nvar ErrSyncPRExists = errors.New(\"sync pull request already exists\")\n```\nErrSyncPRExists reports that the sync pull request the caller asked for is already open, so nothing was created.\n\n## Functions\n\n```go\nfunc IsNotFound(err error) bool\n```\nIsNotFound 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.\n\n## Types\n\n```go\ntype Client struct {\n\tGH      *github.Client\n\tProfile *config.Profile\n}\n```\nClient wraps the GitHub API for a single rel profile.\n\n```go\nfunc NewClient(profile *config.Profile) (*Client, error)\n```\nNewClient 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).\n\n```go\nfunc (c *Client) CheckSyncStatus(ctx context.Context, repo string) (bool, error)\n```\nCheckSyncStatus reports whether the base branch is ahead of the dev branch.\n\n```go\nfunc (c *Client) CheckTeam(ctx context.Context, owner, team string) error\n```\nCheckTeam verifies that the token can list the repositories of a team.\n\n```go\nfunc (c *Client) CompareSyncState(ctx context.Context, repo string) (SyncState, error)\n```\nCompareSyncState 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.\n\n```go\nfunc (c *Client) CreateReleaseBranch(ctx context.Context, repo, branchName string) error\n```\nCreateReleaseBranch cuts a release branch from the dev branch.\n\n```go\nfunc (c *Client) CreateReleasePR(ctx context.Context, repo, branchName, version string) (string, error)\n```\nCreateReleasePR opens the release branch against the base branch.\n\n```go\nfunc (c *Client) CreateSyncPR(ctx context.Context, repo string) (string, error)\n```\nCreateSyncPR opens a PR that merges the base branch back into the dev branch.\n\n```go\nfunc (c *Client) DetectBranches(ctx context.Context, repo string) (base string, dev string, err error)\n```\nDetectBranches 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).\n\n```go\nfunc (c *Client) FetchRepos(ctx context.Context) ([]string, error)\n```\nFetchRepos 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.\n\n```go\nfunc (c *Client) FindOpenReleasePRs(ctx context.Context, repo string) ([]ReleasePR, error)\n```\nFindOpenReleasePRs returns every open release pull request of a repository. The list endpoint never reports mergeability, so the entries only carry the identity of each pull request.\n\n```go\nfunc (c *Client) FindOpenSyncPR(ctx context.Context, repo string) (string, error)\n```\nFindOpenSyncPR 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.\n\n```go\nfunc (c *Client) GetLatestReleaseTag(ctx context.Context, repo string) (string, error)\n```\nGetLatestReleaseTag returns the most recent tag of a repository.\n\n```go\nfunc (c *Client) LatestRelease(ctx context.Context, repo string) (ReleaseInfo, error)\n```\nLatestRelease 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.\n\n```go\nfunc (c *Client) MergePR(ctx context.Context, repo string, number int, method string) (string, error)\n```\nMergePR merges a pull request with the given method (\"squash\", \"merge\" or \"rebase\") and returns the resulting commit SHA.\n\n```go\nfunc (c *Client) PullRequestMergeability(ctx context.Context, repo string, number int) (ReleasePR, error)\n```\nPullRequestMergeability resolves the merge state of a single pull request. GitHub computes it asynchronously and answers \"unknown\" while it works, so an undecided first answer is retried once.\n\n```go\nfunc (c *Client) ResolveOwner(ctx context.Context, owner string) (config.OwnerType, error)\n```\nResolveOwner reports whether the given login is an organization or a user.\n\n```go\ntype ReleaseInfo struct {\n\tTag       string\n\tPublished time.Time\n}\n```\nReleaseInfo describes the most recent release marker of a repository. A zero value means the repository has never been released.\n\n```go\nfunc (r ReleaseInfo) Found() bool\n```\nFound reports whether a release marker was actually resolved.\n\n```go\ntype ReleasePR struct {\n\tNumber int\n\tHead   string\n\tURL    string\n\tDraft  bool\n\t// Mergeable is nil while GitHub is still computing the merge state, and is\n\t// always nil on entries that come from the list endpoint.\n\tMergeable *bool\n\t// MergeableState is GitHub's own verdict: \"clean\", \"unstable\", \"blocked\",\n\t// \"behind\", \"dirty\", \"draft\" or \"unknown\".\n\tMergeableState string\n}\n```\nReleasePR is an open pull request that the release flow cut.\n\n```go\ntype SyncState struct {\n\t// AheadBy counts commits the base branch has that the dev branch lacks.\n\tAheadBy int\n\t// BehindBy counts commits the dev branch has that the base branch lacks.\n\tBehindBy int\n\t// MergeBase is the date of the newest commit both branches share, which is\n\t// effectively the moment they were last in sync.\n\tMergeBase time.Time\n}\n```\nSyncState describes how a repository's base and development branches relate.\n\n```go\nfunc (s SyncState) NeedsSync() bool\n```\nNeedsSync reports whether the base branch has commits the dev branch is missing.\n\n","path":"github.com/gozeloglu/rel/pkg/github","name":"github","synopsis":"","isRedistributable":true}
