Documentation
¶
Overview ¶
Package gitea implements the forge.IssueTracker interface for Gitea using the official Gitea Go SDK.
Index ¶
- type Client
- func (c *Client) AddComment(ctx context.Context, number int, body string) (comment *forge.Comment, err error)
- func (c *Client) AddLabel(ctx context.Context, number int, label string) error
- func (c *Client) Assign(ctx context.Context, number int, assignee string) error
- func (c *Client) CreateBranch(_ context.Context, name string) error
- func (c *Client) CreateIssue(ctx context.Context, req *forge.CreateIssueRequest) (issue *forge.Issue, err error)
- func (c *Client) CreateOrUpdateFile(_ context.Context, branch, path, content, message string) error
- func (c *Client) CreatePullRequest(ctx context.Context, req *forge.CreatePRRequest) (*forge.PullRequest, error)
- func (c *Client) DeleteTestBranch(_ context.Context, name string) error
- func (c *Client) GetCommitLog(_ context.Context, branch string, limit int) ([]forge.Commit, error)
- func (c *Client) GetDiff(ctx context.Context, base, head string) (string, error)
- func (c *Client) GetIssue(ctx context.Context, number int) (issue *forge.Issue, err error)
- func (c *Client) GetPRChecks(ctx context.Context, number int) ([]forge.Check, error)
- func (c *Client) GetPullRequest(ctx context.Context, number int) (*forge.PullRequest, error)
- func (c *Client) ListBranches(_ context.Context) ([]forge.Branch, error)
- func (c *Client) ListComments(ctx context.Context, number int) ([]*forge.Comment, error)
- func (c *Client) ListFiles(_ context.Context, path, ref string) ([]forge.FileEntry, error)
- func (c *Client) ListIssues(ctx context.Context, opts *forge.ListOptions) (issues []*forge.Issue, err error)
- func (c *Client) ListPullRequests(ctx context.Context, opts *forge.ListPROptions) ([]*forge.PullRequest, error)
- func (c *Client) ListReviewComments(ctx context.Context, prNumber int) ([]forge.ReviewComment, error)
- func (c *Client) MergePullRequest(ctx context.Context, number int, method forge.MergeMethod, commitMsg string) error
- func (c *Client) ReadFile(_ context.Context, path, ref string) ([]byte, error)
- func (c *Client) RemoveLabel(ctx context.Context, number int, label string) error
- func (c *Client) SearchCode(_ context.Context, _ string) ([]forge.SearchResult, error)
- func (c *Client) SearchIssues(ctx context.Context, opts *forge.SearchOptions) (issues []*forge.Issue, err error)
- func (c *Client) SetLabels(ctx context.Context, number int, labels []string) error
- func (c *Client) SetPollInterval(d time.Duration)
- func (c *Client) Unassign(ctx context.Context, number int, assignee string) error
- func (c *Client) UpdateIssue(ctx context.Context, number int, req *forge.UpdateIssueRequest) (issue *forge.Issue, err error)
- func (c *Client) Watch(ctx context.Context, handler func(forge.Event)) 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 forge.IssueTracker for Gitea repositories.
func New ¶
New creates a Gitea IssueTracker client for the given owner/repo. The url should be the Gitea instance base URL (e.g., "http://localhost:3000"). Token authenticates via Gitea's "token <token>" header format.
func (*Client) AddComment ¶
func (c *Client) AddComment(ctx context.Context, number int, body string) (comment *forge.Comment, err error)
AddComment posts a new comment on the given issue.
func (*Client) Assign ¶
Assign adds an assignee to the given issue via read-modify-write. Gitea has no dedicated assign endpoint; we read the current assignees, append the new one, and write back via EditIssue.
func (*Client) CreateBranch ¶ added in v0.1.5
CreateBranch creates a new branch from "main" HEAD.
func (*Client) CreateIssue ¶
func (c *Client) CreateIssue(ctx context.Context, req *forge.CreateIssueRequest) (issue *forge.Issue, err error)
CreateIssue creates a new issue on the repository.
func (*Client) CreateOrUpdateFile ¶ added in v0.1.5
CreateOrUpdateFile creates or updates a file on the given branch. If the file already exists its SHA is fetched first so that the update succeeds.
func (*Client) CreatePullRequest ¶ added in v0.1.6
func (c *Client) CreatePullRequest(ctx context.Context, req *forge.CreatePRRequest) (*forge.PullRequest, error)
CreatePullRequest creates a new pull request on the repository.
func (*Client) DeleteTestBranch ¶ added in v0.1.11
DeleteTestBranch deletes a branch by name. It is NOT part of the forge interface and exists solely to support integration test cleanup.
func (*Client) GetCommitLog ¶ added in v0.1.10
GetCommitLog returns the most recent commits on a branch. If branch is empty, "main" is used. Limit defaults to 20 if <= 0.
func (*Client) GetDiff ¶ added in v0.1.10
GetDiff returns the unified diff comparing base and head refs. It calls the Gitea compare API with the .diff suffix to retrieve actual diff content (hunks, file stats). Falls back to a summary if the raw diff endpoint is unavailable.
func (*Client) GetPRChecks ¶ added in v0.1.6
GetPRChecks returns the CI status checks for a pull request's head commit.
func (*Client) GetPullRequest ¶ added in v0.1.6
GetPullRequest retrieves a single pull request by number.
func (*Client) ListBranches ¶ added in v0.1.10
ListBranches returns all branches in the repository.
func (*Client) ListComments ¶
ListComments returns all comments on the given issue.
func (*Client) ListFiles ¶ added in v0.1.10
ListFiles returns the files and directories at the given path and ref. If path is empty, the repository root is listed. If ref is empty, the default branch HEAD is used.
func (*Client) ListIssues ¶
func (c *Client) ListIssues(ctx context.Context, opts *forge.ListOptions) (issues []*forge.Issue, err error)
ListIssues returns issues matching the given filter options.
func (*Client) ListPullRequests ¶ added in v0.1.6
func (c *Client) ListPullRequests(ctx context.Context, opts *forge.ListPROptions) ([]*forge.PullRequest, error)
ListPullRequests returns pull requests matching the given filter options.
func (*Client) ListReviewComments ¶ added in v0.1.8
func (c *Client) ListReviewComments(ctx context.Context, prNumber int) ([]forge.ReviewComment, error)
ListReviewComments returns all inline review comments on a pull request.
func (*Client) MergePullRequest ¶ added in v0.1.6
func (c *Client) MergePullRequest(ctx context.Context, number int, method forge.MergeMethod, commitMsg string) error
MergePullRequest merges a pull request using the specified method.
func (*Client) ReadFile ¶ added in v0.1.10
ReadFile returns the raw bytes of the file at the given path and ref. If ref is empty, the default branch HEAD is used.
func (*Client) RemoveLabel ¶
RemoveLabel removes a single label from the given issue.
func (*Client) SearchCode ¶ added in v0.1.10
SearchCode is not supported by the Gitea SDK v0.23.2 at the repo scope. It returns forge.ErrNotSupported so callers can surface a friendly message.
func (*Client) SearchIssues ¶ added in v0.1.21
func (c *Client) SearchIssues(ctx context.Context, opts *forge.SearchOptions) (issues []*forge.Issue, err error)
SearchIssues performs full-text search across issue titles and bodies using Gitea's keyword search parameter.
func (*Client) SetPollInterval ¶
SetPollInterval configures the polling interval for Watch.
func (*Client) Unassign ¶
Unassign removes an assignee from the given issue via read-modify-write. Gitea has no dedicated unassign endpoint; we read the current assignees, remove the target, and write back via EditIssue.
func (*Client) UpdateIssue ¶
func (c *Client) UpdateIssue(ctx context.Context, number int, req *forge.UpdateIssueRequest) (issue *forge.Issue, err error)
UpdateIssue modifies an existing issue. Nil fields in the request are left unchanged.