Documentation
¶
Overview ¶
Package forgejo implements backend.Backend against the Forgejo REST API (api/v1). Forgejo is Gitea-derived, but its API was verified directly against a live Forgejo instance (codeberg.org) rather than assumed identical: same base path, same release field names (tag_name/name/body/draft), same "Authorization: token <t>" auth scheme, same page/limit list pagination — so the adapter logic mirrors internal/backend/gitea.
Index ¶
- 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(_ context.Context, _ string) (commit.PRReference, bool, error)
- func (c *Client) UpsertDraft(ctx context.Context, req backend.UpsertDraftRequest) error
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 Forgejo instance's REST API.
func New ¶
New returns a Client for owner/repo against the Forgejo instance at baseURL (e.g. "https://codeberg.org" — no trailing slash or "/api/v1" suffix needed, New adds it). Forgejo is self-hosted, so baseURL is always required.
func (*Client) CommitURL ¶
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) Publish ¶
Publish implements backend.Backend: flips the draft release matching tag to published. As with GitHub/Gitea, the underlying git tag doesn't exist until this point; leaving target_commitish unset in the PATCH means Forgejo keeps whatever was set at draft-creation time (also left unset, which resolves to the default branch), so publish always tags the default branch's current state rather than a stale commitish.
func (*Client) ResolveAuthor ¶
ResolveAuthor implements backend.Backend. Unlike GitHub's "get a commit" endpoint, no Forgejo 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 ¶
ResolvePR implements backend.Backend. Forgejo does expose a commits/{sha}/pull lookup, but per ADR-0001 it's confirmed to return the wrong PR in some cases — attaching an incorrect link is worse than attaching none, so this deliberately never calls it and always reports "not supported". Only ticket 05's text extraction (the "Reviewed-on:" trailer) applies for Forgejo.
func (*Client) UpsertDraft ¶
UpsertDraft implements backend.Backend.