gitea

package
v0.24.5 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

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"
	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 *gitea.Response, currentPage int) (bool, int)

Types

type Provider

type Provider struct {
	Client *gitea.Client
	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) CreateStatus

func (v *Provider) CreateStatus(_ context.Context, event *info.Event, statusOpts provider.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) 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(_ context.Context, runevent *info.Event) (changedfiles.ChangedFiles, error)

func (*Provider) GetStringPullRequestComment

func (v *Provider) GetStringPullRequestComment(_ context.Context, runevent *info.Event, reg string) ([]*gitea.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, _ *info.Event, _ string) (bool, string, error)

GetTaskURI TODO: Implement ME.

func (*Provider) GetTektonDir

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

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 owner file 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) SetLogger

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

func (*Provider) Validate

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

type PushPayload added in v0.23.0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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