gitea

package
v0.97.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gitea implements the Gitea provider.

Index

Constants

View Source
const (
	ID               = "gitea"
	EndpointKey      = "endpoint"
	TokenKey         = "token"
	WebhookSecretKey = "webhook_secret"
)

Variables

This section is empty.

Functions

func GetWebhookSecret added in v0.92.0

func GetWebhookSecret() string

GetWebhookSecret reads the webhook HMAC secret from the gitea provider config.

Types

type ChangesFromPayload added in v0.13.1

type ChangesFromPayload struct {
	From string `json:"from"`
}

ChangesFromPayload represents the payload information of issue change

type ChangesPayload added in v0.13.1

type ChangesPayload struct {
	Title *ChangesFromPayload `json:"title,omitempty"`
	Body  *ChangesFromPayload `json:"body,omitempty"`
	Ref   *ChangesFromPayload `json:"ref,omitempty"`
}

ChangesPayload represents the payload information of issue change

type Commit added in v0.28.1

type Commit struct {
	Id           string      `json:"id"`
	Message      string      `json:"message"`
	Url          string      `json:"url"`
	Author       *gitea.User `json:"author"`
	Committer    *gitea.User `json:"committer"`
	Verification any         `json:"verification"`
	Timestamp    string      `json:"timestamp"`
	Added        []string    `json:"added"`
	Removed      []string    `json:"removed"`
	Modified     []string    `json:"modified"`
}

type CommitDiff added in v0.28.1

type CommitDiff struct {
	CommitID      string   `json:"commit_id"`
	CommitMessage string   `json:"commit_message"`
	Files         []string `json:"files"`
	DiffContent   string   `json:"diff_content"`
}

type Gitea

type Gitea struct {
	// contains filtered or unexported fields
}

func GetClient added in v0.28.11

func GetClient() (*Gitea, error)

func NewGitea

func NewGitea(endpoint, token string) (*Gitea, error)

func (*Gitea) GetCommitDiff added in v0.28.1

func (v *Gitea) GetCommitDiff(owner, repo, commitID string) ([]byte, error)

func (*Gitea) GetDiff added in v0.28.1

func (v *Gitea) GetDiff(owner, repo, commitID string) (*CommitDiff, error)

func (*Gitea) GetFileContent added in v0.28.1

func (v *Gitea) GetFileContent(owner, repo, commitID, filePath string, lineStart, lineCount int) ([]byte, error)

func (*Gitea) GetMyUserInfo added in v0.22.1

func (v *Gitea) GetMyUserInfo() (*gitea.User, error)

func (*Gitea) GetRepositories

func (v *Gitea) GetRepositories(owner, reponame string) (*gitea.Repository, error)

func (*Gitea) ListIssues added in v0.22.1

func (v *Gitea) ListIssues(owner string, page, pageSize int) ([]*gitea.Issue, error)

type HookIssueAction added in v0.13.1

type HookIssueAction string

HookIssueAction represents the action that is sent along with an issue event.

const (
	// HookIssueOpened opened
	HookIssueOpened HookIssueAction = "opened"
	// HookIssueClosed closed
	HookIssueClosed HookIssueAction = "closed"
	// HookIssueReOpened reopened
	HookIssueReOpened HookIssueAction = "reopened"
	// HookIssueEdited edited
	HookIssueEdited HookIssueAction = "edited"
	// HookIssueAssigned assigned
	HookIssueAssigned HookIssueAction = "assigned"
	// HookIssueUnassigned unassigned
	HookIssueUnassigned HookIssueAction = "unassigned"
	// HookIssueLabelUpdated label_updated
	HookIssueLabelUpdated HookIssueAction = "label_updated"
	// HookIssueLabelCleared label_cleared
	HookIssueLabelCleared HookIssueAction = "label_cleared"
	// HookIssueSynchronized synchronized
	HookIssueSynchronized HookIssueAction = "synchronized"
	// HookIssueMilestoned is an issue action for when a milestone is set on an issue.
	HookIssueMilestoned HookIssueAction = "milestoned"
	// HookIssueDemilestoned is an issue action for when a milestone is cleared on an issue.
	HookIssueDemilestoned HookIssueAction = "demilestoned"
	// HookIssueReviewed is an issue action for when a pull request is reviewed
	HookIssueReviewed HookIssueAction = "reviewed"
	// HookIssueReviewRequested is an issue action for when a reviewer is requested for a pull request.
	HookIssueReviewRequested HookIssueAction = "review_requested"
	// HookIssueReviewRequestRemoved is an issue action for removing a review request to someone on a pull request.
	HookIssueReviewRequestRemoved HookIssueAction = "review_request_removed"
	// HookIssueCreated is an issue action for when an issue is created
	HookIssueCreated HookIssueAction = "created"
)

type IssuePayload added in v0.13.1

type IssuePayload struct {
	Action     HookIssueAction   `json:"action"`
	Index      int64             `json:"number"`
	Changes    *ChangesPayload   `json:"changes,omitempty"`
	Issue      *gitea.Issue      `json:"issue"`
	Repository *gitea.Repository `json:"repository"`
	Sender     *gitea.User       `json:"sender"`
	CommitID   string            `json:"commit_id"`
}

IssuePayload represents the payload information that is sent along with an issue event.

func (*IssuePayload) JSONPayload added in v0.13.1

func (p *IssuePayload) JSONPayload() ([]byte, error)

JSONPayload encodes the IssuePayload to JSON, with an indentation of two spaces.

type RepoPayload added in v0.28.1

type RepoPayload struct {
	Ref          string            `json:"ref"`
	Before       string            `json:"before"`
	After        string            `json:"after"`
	CompareUrl   string            `json:"compare_url"`
	Commits      []*Commit         `json:"commits"`
	TotalCommits int               `json:"total_commits"`
	HeadCommit   *Commit           `json:"head_commit"`
	Pusher       *gitea.User       `json:"pusher"`
	Repository   *gitea.Repository `json:"repository"`
	Sender       *gitea.User       `json:"sender"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL