gitea

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements backend.Backend against a Gitea instance's REST API.

func New

func New(baseURL, owner, repo, token string) *Client

New returns a Client for owner/repo against the Gitea instance at baseURL (e.g. "https://gitea.example.com" — no trailing slash or "/api/v1" suffix needed, New adds it). Unlike GitHub's fixed api.github.com, Gitea is self-hosted, so baseURL is always required.

func (*Client) CommitURL

func (c *Client) CommitURL(sha string) string

CommitURL implements backend.Backend, using baseURL as the instance's web root (same host as the API, just without the "/api/v1" prefix).

func (*Client) CompareURL added in v0.2.0

func (c *Client) CompareURL(from, to string) string

CompareURL implements backend.Backend.

func (*Client) Publish

func (c *Client) Publish(ctx context.Context, tag string) error

Publish implements backend.Backend: flips the draft release matching tag to published. As with GitHub, the underlying git tag doesn't exist until this point; leaving target_commitish unset in the PATCH means Gitea keeps whatever was set at draft-creation time (also left unset, which Gitea resolves to the default branch), so publish always tags the default branch's current state rather than a stale commitish.

func (*Client) ResolveAuthor

func (c *Client) ResolveAuthor(_ context.Context, _ string) (backend.AuthorReference, bool, error)

ResolveAuthor implements backend.Backend. Unlike GitHub's "get a commit" endpoint, no Gitea endpoint returning a commit's linked account has been verified against a live instance — per ADR-0001, this always reports "not supported" rather than attempting an unverified lookup.

func (*Client) ResolvePR

func (c *Client) ResolvePR(_ context.Context, _ string) (commit.PRReference, bool, error)

ResolvePR implements backend.Backend. Gitea has no commit→PR lookup endpoint (unlike GitHub's commits/{sha}/pulls) — per ADR-0001, only ticket 05's text extraction (the "Reviewed-on:" trailer) applies here, so this always reports "not supported" rather than attempting a lookup that doesn't exist.

func (*Client) UpsertDraft

func (c *Client) UpsertDraft(ctx context.Context, req backend.UpsertDraftRequest) error

UpsertDraft implements backend.Backend.

Jump to

Keyboard shortcuts

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