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
- type Client
- func (c *Client) CommitURL(sha string) string
- func (c *Client) Publish(ctx context.Context, tag string) error
- func (c *Client) ResolveAuthor(_ context.Context, _ string) (backend.AuthorReference, bool, error)
- func (c *Client) ResolvePR(ctx context.Context, sha string) (commit.PRReference, bool, error)
- func (c *Client) UpsertDraft(ctx context.Context, req backend.UpsertDraftRequest) error
Constants ¶
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 ¶
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) Publish ¶
Publish implements backend.Backend: flips the draft's released_at to now, clearing upcoming_release.
func (*Client) ResolveAuthor ¶
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 ¶
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 ¶
UpsertDraft implements backend.Backend, faking a "draft" via GitLab's Upcoming Release mechanism (see package doc).