gitea

package
v0.28.3 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateSignature

func ValidateSignature(payload []byte, signature string, secretKey []byte) error

Types

type GiteaClient

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

func NewClient

func NewClient(baseURL string, username string, token string, pagesize int, logger logging.SimpleLogging) (*GiteaClient, error)

NewClient builds a client that makes API calls to Gitea. httpClient is the client to use to make the requests, username and password are used as basic auth in the requests, baseURL is the API's baseURL, ex. https://corp.com:7990. Don't include the API version, ex. '/1.0'.

func (*GiteaClient) CreateComment

func (c *GiteaClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, command string) error

CreateComment creates a comment on the merge request. As far as we're aware, Gitea has no built in max comment length right now.

func (*GiteaClient) DiscardReviews

func (c *GiteaClient) DiscardReviews(repo models.Repo, pull models.PullRequest) error

DiscardReviews discards / dismisses all pull request reviews

func (*GiteaClient) GetCloneURL

func (c *GiteaClient) GetCloneURL(logger logging.SimpleLogging, _ models.VCSHostType, repo string) (string, error)

GetCloneURL returns the clone URL of the repo

func (*GiteaClient) GetFileContent

func (c *GiteaClient) GetFileContent(logger logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error)

GetFileContent a repository file content from VCS (which support fetch a single file from repository) The first return value indicates whether the repo contains a file or not if BaseRepo had a file, its content will placed on the second return value

func (*GiteaClient) GetModifiedFiles

func (c *GiteaClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)

GetModifiedFiles returns the names of files that were modified in the merge request relative to the repo root, e.g. parent/child/file.txt.

func (*GiteaClient) GetPullLabels

func (c *GiteaClient) GetPullLabels(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)

GetPullLabels returns the labels of a pull request

func (*GiteaClient) GetPullRequest

func (c *GiteaClient) GetPullRequest(logger logging.SimpleLogging, repo models.Repo, pullNum int) (*gitea.PullRequest, error)

func (*GiteaClient) GetTeamNamesForUser

func (c *GiteaClient) GetTeamNamesForUser(repo models.Repo, user models.User) ([]string, error)

GetTeamNamesForUser returns the names of the teams or groups that the user belongs to (in the organization the repository belongs to).

func (*GiteaClient) HidePrevCommandComments

func (c *GiteaClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, dir string) error

HidePrevCommandComments hides the previous command comments from the pull request.

func (c *GiteaClient) MarkdownPullLink(pull models.PullRequest) (string, error)

MarkdownPullLink specifies the string used in a pull request comment to reference another pull request.

func (*GiteaClient) MergePull

func (c *GiteaClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, pullOptions models.PullRequestOptions) error

func (*GiteaClient) PullIsApproved

func (c *GiteaClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error)

PullIsApproved returns ApprovalStatus with IsApproved set to true if the pull request has a review that approved the PR.

func (*GiteaClient) PullIsMergeable

func (c *GiteaClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, vcsstatusname string) (bool, error)

PullIsMergeable returns true if the pull request is mergeable

func (*GiteaClient) ReactToComment

func (c *GiteaClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, reaction string) error

ReactToComment adds a reaction to a comment.

func (*GiteaClient) SupportsSingleFileDownload

func (c *GiteaClient) SupportsSingleFileDownload(repo models.Repo) bool

SupportsSingleFileDownload returns true if the VCS supports downloading a single file

func (*GiteaClient) UpdateStatus

func (c *GiteaClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, state models.CommitStatus, src string, description string, url string) error

UpdateStatus updates the commit status to state for pull. src is the source of this status. This should be relatively static across runs, ex. atlantis/plan or atlantis/apply. description is a description of this particular status update and can change across runs. url is an optional link that users should click on for more information about this status.

type GiteaIssueCommentPayload

type GiteaIssueCommentPayload struct {
	Action     string           `json:"action"`
	Comment    gitea.Comment    `json:"comment"`
	Repository gitea.Repository `json:"repository"`
	Issue      gitea.Issue      `json:"issue"`
}

type GiteaPRReviewSummary

type GiteaPRReviewSummary struct {
	Reviews []GiteaReview
}

type GiteaPullGetter

type GiteaPullGetter interface {
	GetPullRequest(repo models.Repo, pullNum int) (*gitea.PullRequest, error)
}

type GiteaReview

type GiteaReview struct {
	ID          int64
	Body        string
	Reviewer    string
	State       gitea.ReviewStateType // e.g., "APPROVED", "PENDING", "REQUEST_CHANGES"
	SubmittedAt time.Time
}

type GiteaWebhookPayload

type GiteaWebhookPayload struct {
	Action      string            `json:"action"`
	Number      int               `json:"number"`
	PullRequest gitea.PullRequest `json:"pull_request"`
}

Jump to

Keyboard shortcuts

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