releasecheck

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package releasecheck decides whether a pushed tag may become a tanGO release. The release workflow runs it (see cmd/releasecheck) and creates the GitHub release only when it passes; RELEASING.md describes the whole process.

Index

Constants

This section is empty.

Variables

View Source
var RequiredJobs = []string{"lint", "test (sqlite)", "test (postgres)"}

RequiredJobs are the CI jobs that must all succeed on the exact commit a release tags.

Functions

func Check

func Check(ctx context.Context, r Release, s Sources) (string, error)

Check returns the release notes for r — its CHANGELOG.md section — or an error listing every reason r may not be released.

Types

type CIJob

type CIJob struct {
	Name       string
	Status     string
	Conclusion string
}

CIJob is one job of a CIRun.

func (*CIJob) UnmarshalJSON

func (j *CIJob) UnmarshalJSON(data []byte) error

CIJob decodes from the GitHub API's job objects.

type CIRun

type CIRun struct {
	Status     string // queued, in_progress, completed, ...
	Conclusion string // success, failure, ... once completed
	Jobs       []CIJob
}

CIRun is one CI workflow run and its jobs.

type Live

type Live struct {
	Dir    string       // the git checkout, with main fetched as origin/main
	Repo   string       // owner/name on GitHub
	Module string       // the module path, e.g. github.com/angvp/tango
	Token  string       // a GitHub token that can read Actions runs
	Client *http.Client // nil means http.DefaultClient
	API    string       // "" means https://api.github.com
	Proxy  string       // "" means https://proxy.golang.org
}

Live looks things up in the git checkout, the GitHub Actions API and the Go module proxy.

func (Live) CIRuns

func (l Live) CIRuns(ctx context.Context, commit string) ([]CIRun, error)

CIRuns returns the CI workflow's runs for commit, each with the jobs of its latest attempt.

func (Live) OnMain

func (l Live) OnMain(ctx context.Context, commit string) (bool, error)

OnMain asks git whether commit is an ancestor of origin/main.

func (Live) PublishedCommit

func (l Live) PublishedCommit(ctx context.Context, tag string) (string, error)

PublishedCommit asks the Go module proxy which commit it serves for tag.

type Release

type Release struct {
	Tag       string // the pushed tag, e.g. v0.1.1
	Commit    string // the full SHA the tag points to
	Changelog []byte // CHANGELOG.md at that commit
	// Gorelease is gorelease's report comparing the tagged commit with the
	// previous release, or "" if it wasn't run.
	Gorelease string
}

Release is a pushed tag and what the workflow gathered about it.

type Sources

type Sources interface {
	// OnMain reports whether commit is reachable from main.
	OnMain(ctx context.Context, commit string) (bool, error)
	// CIRuns returns every CI workflow run for exactly commit.
	CIRuns(ctx context.Context, commit string) ([]CIRun, error)
	// PublishedCommit returns the commit the Go module proxy already serves
	// for tag, or "" if it doesn't know the tag.
	PublishedCommit(ctx context.Context, tag string) (string, error)
}

Sources looks up what the tag alone doesn't say.

Directories

Path Synopsis
cmd
releasecheck command
Command releasecheck decides whether a pushed tag may become a tanGO release, and writes its release notes.
Command releasecheck decides whether a pushed tag may become a tanGO release, and writes its release notes.

Jump to

Keyboard shortcuts

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