github

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package github publishes releases and their assets to GitHub and GitHub Enterprise Server through the REST API (go-github, ADR-0077).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v0.82.0

type Client struct {

	// MakeLatest is sent as make_latest ("true" or "false") with the request that publishes the
	// release; empty sends nothing and leaves the choice to GitHub.
	MakeLatest string
	// contains filtered or unexported fields
}

Client publishes GitHub releases over the REST API through go-github (ADR-0077).

func NewClient added in v0.82.0

func NewClient(baseURL, repository, token string, getenv func(string) string) (*Client, error)

NewClient builds a client for repository ("owner/repo") on the GitHub instance whose web root is baseURL (empty means github.com). The API root comes from config.GitHubAPIURL, which reads GITHUB_API_URL through getenv in GitHub Actions.

func (*Client) CreateRelease added in v0.82.0

func (c *Client) CreateRelease(ctx context.Context, tag, commit, notes string, draft, prerelease bool, assets []platforms.Asset) ([]string, error)

CreateRelease publishes the release for tag and returns the names GitHub gave the uploaded assets, which can differ from the file names (GitHub rewrites special characters). Without assets it is one create call. With assets the release is created as a draft, each file is uploaded, then the draft is published unless draft is set: uploading to a published release fails when immutable releases are on. If an upload or the publish fails, the draft is deleted so a re-run starts clean; a failed delete is appended to the original error. ctx stops the requests (Ctrl-C); the delete runs on its own short context, so it still happens once ctx is cancelled.

func (*Client) VerifyReleasesAccess added in v0.82.0

func (c *Client) VerifyReleasesAccess(ctx context.Context) error

VerifyReleasesAccess checks that the token can read the repository's releases.

type Platform

type Platform struct {
	// contains filtered or unexported fields
}

Platform implements port.Platform for GitHub over the REST API (ADR-0077).

func New

func New(cfg *config.Platform) *Platform

New constructs a GitHub Platform.

func (*Platform) Check

func (p *Platform) Check(ctx context.Context) error

Check verifies a token is available, the repository is resolvable, and the token can read the repository's releases.

func (*Platform) CheckAssets added in v0.81.0

func (p *Platform) CheckAssets() error

CheckAssets applies the asset rules (confinement to the repository, and every pattern matching a file unless release.allow_missing_assets is set) ahead of publishing, and refuses two files GitHub would publish under one name: it renames special characters and compares names without case.

func (*Platform) CreateRelease

func (p *Platform) CreateRelease(ctx context.Context, tag, notes string, prerelease bool) error

CreateRelease publishes the release through the REST API (Client.CreateRelease). Asset globs resolve leniently: the tag is already pushed by now, so a pattern matching nothing warns and is skipped rather than failing the release. Each asset is opened once and uploaded from that descriptor (NEW-002), and a name GitHub rewrites is reported. prerelease is derived by the caller from the resolved version (ADR-0064), not read from config.

func (*Platform) HasAssets

func (p *Platform) HasAssets() bool

func (*Platform) LinkContext added in v0.24.0

func (p *Platform) LinkContext() port.LinkContext

LinkContext resolves this platform's link coordinates. GitHub repositories are owner/repo, so the path splits on the first slash. BaseURL falls back to the default host when unset (e.g. a config that was not run through the loader's normalize step).

func (*Platform) Name

func (p *Platform) Name() string

func (*Platform) ReleaseURL

func (p *Platform) ReleaseURL(tag string) string

func (*Platform) ReleaseURLFromContext added in v0.36.5

func (p *Platform) ReleaseURLFromContext(tag string, lc *port.LinkContext) string

ReleaseURLFromContext builds the release URL from a pre-resolved link context so the displayed URL stays consistent with the one used to generate release notes (ADR-0022). Ambient contexts carry the full project URL in BaseURL (Owner/Repo empty); platform contexts carry the host in BaseURL with Owner and Repo set separately.

func (*Platform) SetLatest added in v1.0.1

func (p *Platform) SetLatest(latest bool)

SetLatest decides whether the next release published becomes the repository's "Latest".

func (*Platform) WithRunner added in v1.0.1

func (p *Platform) WithRunner(r port.Runner) *Platform

WithRunner gives the driver the git runner it reads a tag's commit with, so a release names the commit it was tagged on.

Jump to

Keyboard shortcuts

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