backend

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package backend defines the interface every git hosting adapter (GitHub, GitLab, Gitea, Forgejo) implements identically.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorReference

type AuthorReference struct {
	Login      string
	ProfileURL string
}

AuthorReference is a commit author's linked account on the backend, resolved via a live API call — the git commit's author name/email alone carries no such account (ADR-0001's rationale for PRReference applies identically here: link only what a reliable source confirms).

type Backend

type Backend interface {
	// UpsertDraft creates a draft release for req.Tag if none exists, or
	// updates its body if one does — idempotent. It errors rather than
	// silently mutating a release that already exists for req.Tag and is
	// published (not a draft).
	UpsertDraft(ctx context.Context, req UpsertDraftRequest) error

	// Publish promotes the draft release for tag to published.
	Publish(ctx context.Context, tag string) error

	// ResolvePR looks up the PR associated with sha via a live API call.
	// ok is false when unsupported by this backend (see ADR-0001) or when
	// no PR was found.
	ResolvePR(ctx context.Context, sha string) (ref commit.PRReference, ok bool, err error)

	// CommitURL returns the web URL for viewing sha on this backend's
	// hosting UI. Pure string formatting from the repo coordinates the
	// adapter was constructed with — no API call, always succeeds.
	CommitURL(sha string) string

	// CompareURL returns the web URL for diffing from..to (tag or ref
	// names) on this backend's hosting UI. Pure string formatting, like
	// CommitURL — no API call, always succeeds.
	CompareURL(from, to string) string

	// ResolveAuthor looks up the account linked to sha's commit author via
	// a live API call. ok is false when unsupported by this backend or
	// when the commit's author has no linked account (e.g. a git author
	// email not tied to one) — callers fall back to the plain git author
	// name rather than guessing an account (ADR-0001).
	ResolveAuthor(ctx context.Context, sha string) (ref AuthorReference, ok bool, err error)
}

Backend is implemented identically by every git hosting adapter.

type UpsertDraftRequest

type UpsertDraftRequest struct {
	Tag  string
	Name string // release title; adapters default to Tag when empty
	Body string // rendered changelog body (engine.Plan.Rendered)
}

UpsertDraftRequest is what's needed to create or update the draft release for one tag.

Directories

Path Synopsis
Package forgejo implements backend.Backend against the Forgejo REST API (api/v1).
Package forgejo implements backend.Backend against the Forgejo REST API (api/v1).
Package gitea implements backend.Backend against the Gitea REST API (api/v1), which is close enough to GitHub's release API in shape (tag_name/name/body/draft) that the adapter logic mirrors internal/backend/github — the differences are the base path, the Authorization header scheme, and list pagination's query param names.
Package gitea implements backend.Backend against the Gitea REST API (api/v1), which is close enough to GitHub's release API in shape (tag_name/name/body/draft) that the adapter logic mirrors internal/backend/github — the differences are the base path, the Authorization header scheme, and list pagination's query param names.
Package github implements backend.Backend against the GitHub REST API.
Package github implements backend.Backend against the GitHub REST API.
Package gitlab implements backend.Backend against the GitLab Releases API.
Package gitlab implements backend.Backend against the GitLab Releases API.

Jump to

Keyboard shortcuts

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