Help us shape the future of Go! Take the 2026 Go Developer Survey

gitea

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ForgejoSignatureHeader = "X-Forgejo-Signature"
	GiteaSignatureHeader   = "X-Gitea-Signature"
)
View Source
const (
	EventTypeCreate              whEventType = "create"
	EventTypeDelete              whEventType = "delete"
	EventTypeFork                whEventType = "fork"
	EventTypePush                whEventType = "push"
	EventTypeIssues              whEventType = "issues"
	EventTypeIssueComment        whEventType = "issue_comment"
	EventTypeRepository          whEventType = "repository"
	EventTypeRelease             whEventType = "release"
	EventTypePullRequest         whEventType = "pull_request"
	EventTypePullRequestApproved whEventType = "pull_request_approved"
	EventTypePullRequestRejected whEventType = "pull_request_rejected"
	EventTypePullRequestLabel    whEventType = "pull_request_label"
	EventTypePullRequestComment  whEventType = "pull_request_comment"
	EventTypePullRequestSync     whEventType = "pull_request_sync"
)

List of supported events

Find them in Gitea's source at /models/webhook.go as HookEventType. To correlate with when each of these trigger, see the Trigger On -> Custom Events options when editing a repo's webhook in a Gitea project. Those descriptions are helpful.

Variables

This section is empty.

Functions

func ShouldGetNextPage added in v0.23.0

func ShouldGetNextPage(resp *forgejo.Response, currentPage int) (bool, int)

Types

type Provider

type Provider struct {
	Logger *zap.SugaredLogger

	Token *string

	// only exposed for e2e tests
	Password string
	// contains filtered or unexported fields
}

func (*Provider) CheckPolicyAllowing added in v0.20.0

func (v *Provider) CheckPolicyAllowing(_ context.Context, event *info.Event, allowedTeams []string) (bool, string)

func (*Provider) Client

func (v *Provider) Client() *forgejo.Client

func (*Provider) CreateComment added in v0.34.0

func (v *Provider) CreateComment(_ context.Context, event *info.Event, commit, updateMarker string) error

func (*Provider) CreateStatus

func (v *Provider) CreateStatus(ctx context.Context, event *info.Event, statusOpts providerstatus.StatusOpts) error

func (*Provider) CreateToken added in v0.19.0

func (v *Provider) CreateToken(_ context.Context, _ []string, _ *info.Event) (string, error)

func (*Provider) Detect

func (v *Provider) Detect(req *http.Request, payload string, logger *zap.SugaredLogger) (bool, bool, *zap.SugaredLogger, string, error)

Detect processes event and detect if it is a gitea event, whether to process or reject it returns (if is a Gitea event, whether to process or reject, logger with event metadata,, error if any occurred).

func (*Provider) GetCommitInfo

func (v *Provider) GetCommitInfo(_ context.Context, runevent *info.Event) error

func (*Provider) GetCommitStatuses added in v0.44.0

func (v *Provider) GetCommitStatuses(_ context.Context, event *info.Event) ([]provider.CommitStatusInfo, error)

func (*Provider) GetConfig

func (v *Provider) GetConfig() *info.ProviderConfig

func (*Provider) GetFileInsideRepo

func (v *Provider) GetFileInsideRepo(_ context.Context, runevent *info.Event, path, target string) (string, error)

func (*Provider) GetFiles

func (v *Provider) GetFiles(ctx context.Context, runevent *info.Event) (changedfiles.ChangedFiles, error)

GetFiles gets and caches the list of files changed by a given event.

func (*Provider) GetStringPullRequestComment

func (v *Provider) GetStringPullRequestComment(_ context.Context, runevent *info.Event, reg string) ([]*forgejo.Comment, error)

GetStringPullRequestComment return the comment if we find a regexp in one of the comments text of a pull request.

func (*Provider) GetTaskURI added in v0.13.0

func (v *Provider) GetTaskURI(_ context.Context, event *info.Event, uri string) (bool, string, error)

func (*Provider) GetTektonDir

func (v *Provider) GetTektonDir(_ context.Context, event *info.Event, path, provenance string) (string, error)

func (*Provider) GetTemplate added in v0.34.0

func (v *Provider) GetTemplate(commentType provider.CommentType) string

func (*Provider) IsAllowed

func (v *Provider) IsAllowed(ctx context.Context, event *info.Event) (bool, error)

func (*Provider) IsAllowedOwnersFile added in v0.22.1

func (v *Provider) IsAllowedOwnersFile(ctx context.Context, rev *info.Event) (bool, error)

IsAllowedOwnersFile get the OWNERS files from main branch and check if we have explicitly allowed the user in there.

func (*Provider) ParsePayload

func (v *Provider) ParsePayload(_ context.Context, _ *params.Run, request *http.Request,
	payload string,
) (*info.Event, error)

func (*Provider) SetClient

func (v *Provider) SetClient(_ context.Context, run *params.Run, runevent *info.Event, repo *v1alpha1.Repository, emitter *events.EventEmitter) error

func (*Provider) SetGiteaClient added in v0.34.0

func (v *Provider) SetGiteaClient(client *forgejo.Client)

func (*Provider) SetLogger

func (v *Provider) SetLogger(logger *zap.SugaredLogger)

func (*Provider) SetPacInfo added in v0.26.0

func (v *Provider) SetPacInfo(pacInfo *info.PacOpts)

func (*Provider) Validate

func (v *Provider) Validate(_ context.Context, _ *params.Run, event *info.Event) error

type PushPayload added in v0.23.0

type PushPayload struct {
	Commits []forgejo.PayloadCommit `json:"commits,omitempty"`
}

Directories

Path Synopsis
Package forgejostructs contains Gitea webhook payload types.
Package forgejostructs contains Gitea webhook payload types.

Jump to

Keyboard shortcuts

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