gitlab

package
v0.1.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: 11 Imported by: 0

Documentation

Overview

Package gitlab implements backend.Backend against the GitLab Releases API. GitLab has no draft/hidden release state like GitHub's — UpsertDraft fakes one via GitLab's "Upcoming Release" mechanism: a release whose released_at is set to a future date is flagged upcoming_release=true and badged "Upcoming Release" in the UI. Publish flips released_at to the current time, clearing the flag.

Unlike GitHub/Gitea/Forgejo, this means the underlying git tag is created as soon as the "draft" exists: GitLab's create-release endpoint requires ref up front to create the tag when it doesn't exist yet — there's no way to create a release without also creating its tag.

Index

Constants

View Source
const DefaultBaseURL = "https://gitlab.com"

DefaultBaseURL is gitlab.com's root — used when the caller doesn't override it for a self-hosted instance.

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 GitLab instance's REST API (api/v4) — gitlab.com by default, or a self-hosted instance via baseURL.

func New

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

New returns a Client for owner/repo against the GitLab instance at baseURL (e.g. "https://gitlab.com", or a self-hosted root — no trailing slash or "/api/v4" suffix needed, New adds it). repo may itself contain "/" for a nested group (e.g. "subgroup/project").

func (*Client) CommitURL

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

CommitURL implements backend.Backend.

func (*Client) Publish

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

Publish implements backend.Backend: flips the draft's released_at to now, clearing upcoming_release.

func (*Client) ResolveAuthor

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

ResolveAuthor implements backend.Backend. GitLab's "get a single commit" endpoint returns only the raw git author_name/author_email, not a linked account — per ADR-0001, this always reports "not supported" rather than guessing one from an unverified lookup.

func (*Client) ResolvePR

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

ResolvePR implements backend.Backend using GitLab's "list merge requests associated with a commit" endpoint — a documented, reliable lookup (unlike Forgejo's equivalent, flagged unreliable per ADR-0001).

func (*Client) UpsertDraft

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

UpsertDraft implements backend.Backend, faking a "draft" via GitLab's Upcoming Release mechanism (see package doc).

Jump to

Keyboard shortcuts

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