Documentation
¶
Overview ¶
Package propose writes the release branch and opens or updates its merge request.
It composes two halves that are independently testable: the git side (tree), which needs no credentials, and the forge side, which is reached through the narrowest interface that does the job rather than through a whole provider.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMissingField = errors.New("release proposal: missing required field")
ErrMissingField reports a required input absent from a Request.
Functions ¶
This section is empty.
Types ¶
type Outcome ¶
type Outcome struct {
Action Action
Number int
URL string
Title string
Body string
// Commit is the release commit written; Base is the target head it was cut
// from.
Commit string
Base string
// NotHonoured names what the forge could not apply to the merge request.
// The request EXISTS when this is set — see the note in open().
NotHonoured string
}
Outcome reports what happened.
type Proposer ¶
type Proposer struct {
// contains filtered or unexported fields
}
Proposer writes the release branch and its merge request.
func (*Proposer) Do ¶
Do re-cuts the release branch, then opens or updates its merge request.
The branch is written FIRST, deliberately. A merge request pointing at a branch that was never pushed is visible and wrong; a pushed branch with no merge request is invisible and self-corrects on the next run.
type Recutter ¶
Recutter re-cuts the release branch. Satisfied by tree.Recutter.
type Request ¶
type Request struct {
Owner string
Repo string
// Remote is the clone location for the re-cut.
Remote string
// Target is the branch being released from; Branch is the release branch.
Target string
Branch string
Version string
Changelog string
Considered int
// Files are written into the release commit — the changelog, and whatever
// else a release touches.
Files []tree.File
Author tree.Author
}
Request is one proposal.
type Writer ¶
type Writer interface {
Find(ctx context.Context, owner, repo, sourceBranch string) (forge.PullRequest, error)
Create(ctx context.Context, owner, repo string, draft forge.PullRequestDraft) (forge.PullRequest, error)
Update(ctx context.Context, owner, repo string, number int, title, body string) error
}
Writer is the part of forge.PullRequests that `propose` needs, and nothing more: it cannot close a merge request, and it cannot resolve a merged commit. Declaring the subset keeps the contract honest and lets a three-method fake satisfy it.
Satisfied by forge.PullRequests.