Documentation
¶
Overview ¶
Package gitea provides a thin wrapper around the Gitea Go SDK for managing repositories, issues, and pull requests on a Gitea instance.
Authentication is resolved from config file, environment variables, or flag overrides:
- ~/.core/config.yaml keys: gitea.token, gitea.url
- GITEA_TOKEN + GITEA_URL environment variables (override config file)
- Flag overrides via core gitea config --url/--token (highest priority)
Index ¶
- Constants
- func ResolveConfig(flagURL, flagToken string) (url, token string, err error)
- func SaveConfig(url, token string) error
- type Client
- func (c *Client) API() *gitea.Client
- func (c *Client) CreateIssue(owner, repo string, opts gitea.CreateIssueOption) (*gitea.Issue, error)
- func (c *Client) CreateMirror(owner, name, cloneURL, authToken string) (*gitea.Repository, error)
- func (c *Client) CreateOrgRepo(org string, opts gitea.CreateRepoOption) (*gitea.Repository, error)
- func (c *Client) DeleteRepo(owner, name string) error
- func (c *Client) GetCommentBodies(owner, repo string, pr int64) ([]Comment, error)
- func (c *Client) GetIssue(owner, repo string, number int64) (*gitea.Issue, error)
- func (c *Client) GetIssueBody(owner, repo string, issue int64) (string, error)
- func (c *Client) GetPRMeta(owner, repo string, pr int64) (*PRMeta, error)
- func (c *Client) GetPullRequest(owner, repo string, number int64) (*gitea.PullRequest, error)
- func (c *Client) GetRepo(owner, name string) (*gitea.Repository, error)
- func (c *Client) ListIssues(owner, repo string, opts ListIssuesOpts) ([]*gitea.Issue, error)
- func (c *Client) ListOrgRepos(org string) ([]*gitea.Repository, error)
- func (c *Client) ListPullRequests(owner, repo string, state string) ([]*gitea.PullRequest, error)
- func (c *Client) ListUserRepos() ([]*gitea.Repository, error)
- func (c *Client) URL() string
- type Comment
- type ListIssuesOpts
- type PRMeta
Constants ¶
const ( // ConfigKeyURL is the config key for the Gitea instance URL. ConfigKeyURL = "gitea.url" // ConfigKeyToken is the config key for the Gitea API token. ConfigKeyToken = "gitea.token" // DefaultURL is the default Gitea instance URL. DefaultURL = "https://gitea.snider.dev" )
Variables ¶
This section is empty.
Functions ¶
func ResolveConfig ¶
ResolveConfig resolves the Gitea URL and token from all config sources. Flag values take highest priority, then env vars, then config file.
func SaveConfig ¶
SaveConfig persists the Gitea URL and/or token to the config file.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Gitea SDK client with config-based auth.
func NewFromConfig ¶
NewFromConfig creates a Gitea client using the standard config resolution:
- ~/.core/config.yaml keys: gitea.token, gitea.url
- GITEA_TOKEN + GITEA_URL environment variables (override config file)
- Provided flag overrides (highest priority; pass empty to skip)
func (*Client) CreateIssue ¶
func (c *Client) CreateIssue(owner, repo string, opts gitea.CreateIssueOption) (*gitea.Issue, error)
CreateIssue creates a new issue in the given repository.
func (*Client) CreateMirror ¶
func (c *Client) CreateMirror(owner, name, cloneURL, authToken string) (*gitea.Repository, error)
CreateMirror creates a mirror repository on Gitea from a GitHub clone URL. This uses the Gitea migration API to set up a pull mirror. If authToken is provided, it is used to authenticate against the source (e.g. for private GitHub repos).
func (*Client) CreateOrgRepo ¶
func (c *Client) CreateOrgRepo(org string, opts gitea.CreateRepoOption) (*gitea.Repository, error)
CreateOrgRepo creates a new empty repository under an organisation.
func (*Client) DeleteRepo ¶
DeleteRepo deletes a repository from Gitea.
func (*Client) GetCommentBodies ¶
GetCommentBodies returns all comment bodies for a pull request. This reads full content, which is safe on the home lab Gitea instance.
func (*Client) GetIssueBody ¶
GetIssueBody returns the body text of an issue. This reads full content, which is safe on the home lab Gitea instance.
func (*Client) GetPRMeta ¶
GetPRMeta returns structural signals for a pull request. This is the Gitea side of the dual MetaReader described in the pipeline design.
func (*Client) GetPullRequest ¶
GetPullRequest returns a single pull request by number.
func (*Client) GetRepo ¶
func (c *Client) GetRepo(owner, name string) (*gitea.Repository, error)
GetRepo returns a single repository by owner and name.
func (*Client) ListIssues ¶
ListIssues returns issues for the given repository.
func (*Client) ListOrgRepos ¶
func (c *Client) ListOrgRepos(org string) ([]*gitea.Repository, error)
ListOrgRepos returns all repositories for the given organisation.
func (*Client) ListPullRequests ¶
ListPullRequests returns pull requests for the given repository.
func (*Client) ListUserRepos ¶
func (c *Client) ListUserRepos() ([]*gitea.Repository, error)
ListUserRepos returns all repositories for the authenticated user.
type ListIssuesOpts ¶
ListIssuesOpts configures issue listing.
type PRMeta ¶
type PRMeta struct {
Number int64
Title string
State string
Author string
Branch string
BaseBranch string
Labels []string
Assignees []string
IsMerged bool
CreatedAt time.Time
UpdatedAt time.Time
CommentCount int
}
PRMeta holds structural signals from a pull request, used by the pipeline MetaReader for AI-driven workflows.