Help us shape the future of Go! Take the 2026 Go Developer Survey

milestone

package
v1.233.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMilestonePolicy = errors.New("release milestone policy")

ErrMilestonePolicy means a PR is not eligible for the current release train.

Functions

func CheckIncludedPR

func CheckIncludedPR(pr *ReleasePR, milestones []Milestone, baseline string) error

CheckIncludedPR reports why an already merged PR makes the next release invalid.

func CheckMilestonePR

func CheckMilestonePR(pr *ReleasePR, milestones []Milestone, baseline string) error

CheckMilestonePR enforces both ordering and minimum compatibility level. The no-release label is the sole exemption; drafts and bot PRs have no implicit bypass.

func MilestoneVersion

func MilestoneVersion(title string) (*semver.Version, error)

MilestoneVersion accepts complete stable versions, with an optional v prefix. Prereleases derive from a stable milestone; planning milestones are not versions.

func Pages

func Pages[T any](c *Client, path string) ([]T, error)

func ReleaseLabel

func ReleaseLabel(pr *ReleasePR) (string, error)

func RequiredBump

func RequiredBump(baseline, target string) (string, error)

RequiredBump compares the milestone with the published stable baseline. Labels constrain compatibility; they never select, increment or replace this version.

Types

type Client

type Client struct {
	Context context.Context
	API     githubapi.API
	Repo    string
}

func NewClient

func NewClient(ctx context.Context, repo string) (*Client, error)

func (*Client) CheckReleaseHistory

func (c *Client) CheckReleaseHistory(milestones []Milestone, baseline string) error

CheckReleaseHistory rejects milestones that cannot contain the unreleased changes already on the default branch. It never mutates release intent.

func (*Client) CompareCommits

func (c *Client) CompareCommits(base, head string) ([]string, error)

CompareCommits returns the complete source delta from a published baseline.

func (*Client) Get

func (c *Client) Get(path string, out any) error

func (*Client) LatestStable

func (c *Client) LatestStable() (string, error)

func (*Client) ListMilestones

func (c *Client) ListMilestones() ([]Milestone, error)

func (*Client) OpenPRs

func (c *Client) OpenPRs(base string) ([]ReleasePR, error)

func (*Client) ReleaseChanges

func (c *Client) ReleaseChanges(baseline, head, branch string) ([]PullRequest, error)

ReleaseChanges resolves merged PRs from the exact commit range, including pagination and deduplication. Direct commits and incomplete evidence fail closed.

func (*Client) Write

func (c *Client) Write(method, path string, body any) error

type Milestone

type Milestone struct {
	Number int    `json:"number"`
	Title  string `json:"title"`
	State  string `json:"state"`
}

Milestone identifies a GitHub milestone independently of its mutable title.

func NextMilestone

func NextMilestone(milestones []Milestone) (*Milestone, error)

NextMilestone returns the lowest open stable version. Non-versioned planning milestones are ignored. Equivalent version titles are ambiguous, never ordered by creation time, due date, API order or lexical comparison.

type MilestoneChange

type MilestoneChange struct {
	Number int
	Title  string
}

MilestoneChange is a proposed minor-milestone mutation. A zero Number creates a milestone; a positive Number reopens that existing, unpublished milestone.

func MinorMilestoneWindow

func MinorMilestoneWindow(baseline string, milestones []Milestone) ([]MilestoneChange, error)

MinorMilestoneWindow maintains exactly the next three minor slots after the latest stable version. It never creates patch/major versions or closes/deletes any manually maintained milestones (including farther-future minor versions).

type Milestones

type Milestones mg.Namespace

Milestones groups milestone lifecycle and merge-policy Mage targets.

func (Milestones) Check

func (Milestones) Check(repo string) error

Check reconciles PR-head and merge-queue statuses using live metadata. It never checks out or executes a PR's source. Require the Release milestone status in branch protection/rulesets to enforce this policy at merge time.

func (Milestones) Create

func (Milestones) Create(repo, version string) error

CreateMilestone creates a manually chosen patch, minor or major milestone. Repeating the operation reuses the exact semantic version; labels never pick it.

func (Milestones) Ensure

func (Milestones) Ensure(repo string) error

EnsureMinorMilestones keeps the next three minor milestones open. Patch and major milestones are created only through the explicit CreateMilestone target.

func (Milestones) Run

func (Milestones) Run(repo, operation, version string) error

Run is the action adapter. Invalid operations fail before any API request; workflow YAML only transports arguments, never implements dispatch policy.

type PullRequest

type PullRequest struct {
	ReleasePR
	Title       string `json:"title"`
	Body        string `json:"body"`
	Merged      bool   `json:"merged"`
	MergeCommit string `json:"merge_commit_sha"`
	User        struct {
		Login string `json:"login"`
	} `json:"user"`
}

PullRequest includes the live metadata and notes of an associated commit.

type ReleasePR

type ReleasePR struct {
	Number    int        `json:"number"`
	State     string     `json:"state"`
	Milestone *Milestone `json:"milestone"`
	Labels    []struct {
		Name string `json:"name"`
	} `json:"labels"`
	Head struct {
		SHA string `json:"sha"`
	} `json:"head"`
	Base struct {
		Ref string `json:"ref"`
	} `json:"base"`
}

ReleasePR is the live metadata needed by the merge and release checks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL