Documentation
¶
Overview ¶
Package gitea implements the Gitea adapter for the forge capability.
Index ¶
- func New() forge.Service
- func NewWithClient(c client) forge.Service
- type Adapter
- func (a *Adapter) GetCommitDiff(ctx context.Context, owner, repo, commitID string) (*ability.ForgeCommitDiff, error)
- func (a *Adapter) GetFileContent(ctx context.Context, owner, repo, commitID, filePath string, ...) ([]byte, error)
- func (a *Adapter) GetIssue(ctx context.Context, owner, repo string, index int64) (*ability.ForgeIssue, error)
- func (a *Adapter) GetRepo(ctx context.Context, owner, repo string) (*ability.ForgeRepo, error)
- func (a *Adapter) GetUser(ctx context.Context) (*ability.ForgeUser, error)
- func (a *Adapter) ListIssues(ctx context.Context, owner string, q *forge.ListIssuesQuery) (*ability.ListResult[ability.ForgeIssue], error)
- func (a *Adapter) SetCursorSecret(secret []byte)
- type GiteaWebhook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New creates an Adapter using the default provider client. Returns nil when the provider is not configured or unavailable.
func NewWithClient ¶
NewWithClient creates an Adapter with a specific client, useful for testing.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements forge.Service using the Gitea provider client.
func (*Adapter) GetCommitDiff ¶
func (a *Adapter) GetCommitDiff(ctx context.Context, owner, repo, commitID string) (*ability.ForgeCommitDiff, error)
GetCommitDiff returns the diff for a specific commit from the Gitea API.
func (*Adapter) GetFileContent ¶
func (a *Adapter) GetFileContent(ctx context.Context, owner, repo, commitID, filePath string, lineStart, lineCount int) ([]byte, error)
GetFileContent returns file content at a specific commit with line range from the Gitea API.
func (*Adapter) GetIssue ¶
func (a *Adapter) GetIssue(ctx context.Context, owner, repo string, index int64) (*ability.ForgeIssue, error)
GetIssue returns a single issue by owner, repo name, and index from the Gitea API. Because the Gitea SDK does not expose a direct single-issue endpoint, this method fetches issues for the owner and filters by repository name and index.
func (*Adapter) ListIssues ¶
func (a *Adapter) ListIssues(ctx context.Context, owner string, q *forge.ListIssuesQuery) (*ability.ListResult[ability.ForgeIssue], error)
func (*Adapter) SetCursorSecret ¶
SetCursorSecret sets the cursor signing secret (for testing).
type GiteaWebhook ¶
type GiteaWebhook struct {
// contains filtered or unexported fields
}
GiteaWebhook implements ability.WebhookConverter for the Gitea provider. It validates HMAC-SHA256 signature and converts Gitea webhook payloads into DataEvent records.
func NewGiteaWebhook ¶
func NewGiteaWebhook() *GiteaWebhook
NewGiteaWebhook creates a GiteaWebhook that reads the HMAC secret from the gitea provider config at verification time.
func (*GiteaWebhook) Convert ¶
Convert transforms the raw Gitea webhook body into DataEvent records. Event type is determined by the X-Gitea-Event header:
"push" — parsed as RepoPayload, emitted as forge.push "issues" — parsed as IssuePayload, emitted as forge.issue.<action>
Unsupported event types are logged and yield no events.
func (*GiteaWebhook) VerifySignature ¶
func (w *GiteaWebhook) VerifySignature(headers map[string]string, body []byte) error
VerifySignature validates the HMAC-SHA256 signature from the X-Gitea-Signature header. The raw body is signed with the configured webhook secret.
func (*GiteaWebhook) WebhookPath ¶
func (*GiteaWebhook) WebhookPath() string
WebhookPath returns the URL path that receives webhook events from Gitea. The full URL is /webhook/provider/gitea/events.