gitea

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts Opts) (forge.Forge, error)

New returns a Forge implementation that integrates with Gitea, an open source Git service written in Go. See https://gitea.io/

Types

type Gitea

type Gitea struct {
	ClientID     string
	ClientSecret string
	OAuthHost    string
	SkipVerify   bool
	// contains filtered or unexported fields
}

func (*Gitea) Activate

func (c *Gitea) Activate(ctx context.Context, u *model.User, r *model.Repo, link string) error

Activate activates the repository by registering post-commit hooks with the Gitea repository.

func (*Gitea) Auth

func (c *Gitea) Auth(ctx context.Context, token, _ string) (string, error)

Auth uses the Gitea oauth2 access token and refresh token to authenticate a session and return the Gitea account login.

func (*Gitea) BranchHead

func (c *Gitea) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (*model.Commit, error)

BranchHead returns the sha of the head (latest commit) of the specified branch.

func (*Gitea) Branches

func (c *Gitea) Branches(ctx context.Context, u *model.User, r *model.Repo, p *model.ListOptions) ([]string, error)

Branches returns the names of all branches for the named repository.

func (*Gitea) Deactivate

func (c *Gitea) Deactivate(ctx context.Context, u *model.User, r *model.Repo, link string) error

Deactivate deactivates the repository be removing repository push hooks from the Gitea repository.

func (*Gitea) Dir

func (c *Gitea) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]*forge_types.FileMeta, error)

func (*Gitea) File

func (c *Gitea) File(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]byte, error)

File fetches the file from the Gitea repository and returns its contents.

func (*Gitea) Hook

func (c *Gitea) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error)

Hook parses the incoming Gitea hook and returns the Repository and Pipeline details. If the hook is unsupported nil values are returned.

func (*Gitea) Login

func (c *Gitea) Login(ctx context.Context, req *forge_types.OAuthRequest) (*model.User, string, error)

Login authenticates an account with Gitea using basic authentication. The Gitea account details are returned when the user is successfully authenticated.

func (*Gitea) Name

func (c *Gitea) Name() string

Name returns the string name of this driver.

func (*Gitea) Netrc

func (c *Gitea) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error)

Netrc returns a netrc file capable of authenticating Gitea requests and cloning Gitea repositories. The netrc will use the global machine account when configured.

func (*Gitea) Org

func (c *Gitea) Org(ctx context.Context, u *model.User, owner string) (*model.Org, error)

func (*Gitea) OrgMembership

func (c *Gitea) OrgMembership(ctx context.Context, u *model.User, owner string) (*model.OrgPerm, error)

OrgMembership returns if user is member of organization and if user is admin/owner in this organization.

func (*Gitea) PullRequests

func (c *Gitea) PullRequests(ctx context.Context, u *model.User, r *model.Repo, p *model.ListOptions) ([]*model.PullRequest, error)

func (*Gitea) Refresh

func (c *Gitea) Refresh(ctx context.Context, user *model.User) (bool, error)

Refresh refreshes the Gitea oauth2 access token. If the token is refreshed, the user is updated and a true value is returned.

func (*Gitea) Repo

func (c *Gitea) Repo(ctx context.Context, u *model.User, remoteID model.ForgeRemoteID, owner, name string) (*model.Repo, error)

Repo returns the Gitea repository.

func (*Gitea) Repos

func (c *Gitea) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error)

Repos returns a list of all repositories for the Gitea account, including organization repositories.

func (*Gitea) Status

func (c *Gitea) Status(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, workflow *model.Workflow) error

Status is supported by the Gitea driver.

func (*Gitea) TeamPerm

func (c *Gitea) TeamPerm(_ *model.User, _ string) (*model.Perm, error)

TeamPerm is not supported by the Gitea driver.

func (*Gitea) Teams

func (c *Gitea) Teams(ctx context.Context, u *model.User) ([]*model.Team, error)

Teams is supported by the Gitea driver.

func (*Gitea) URL

func (c *Gitea) URL() string

URL returns the root url of a configured forge.

type Opts

type Opts struct {
	URL        string // Gitea server url.
	Client     string // OAuth2 Client ID
	Secret     string // OAuth2 Client Secret
	OAuthHost  string // OAuth2 Host
	SkipVerify bool   // Skip ssl verification.
}

Opts defines configuration options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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