Documentation ¶
Index ¶
- func New(opts Opts) (forge.Forge, error)
- type Gitea
- func (c *Gitea) Activate(ctx context.Context, u *model.User, r *model.Repo, link string) error
- func (c *Gitea) Auth(ctx context.Context, token, _ string) (string, error)
- func (c *Gitea) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (*model.Commit, error)
- func (c *Gitea) Branches(ctx context.Context, u *model.User, r *model.Repo, p *model.ListOptions) ([]string, error)
- func (c *Gitea) Deactivate(ctx context.Context, u *model.User, r *model.Repo, link string) error
- func (c *Gitea) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]*forge_types.FileMeta, error)
- func (c *Gitea) File(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]byte, error)
- func (c *Gitea) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error)
- func (c *Gitea) Login(ctx context.Context, req *forge_types.OAuthRequest) (*model.User, string, error)
- func (c *Gitea) Name() string
- func (c *Gitea) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error)
- func (c *Gitea) Org(ctx context.Context, u *model.User, owner string) (*model.Org, error)
- func (c *Gitea) OrgMembership(ctx context.Context, u *model.User, owner string) (*model.OrgPerm, error)
- func (c *Gitea) PullRequests(ctx context.Context, u *model.User, r *model.Repo, p *model.ListOptions) ([]*model.PullRequest, error)
- func (c *Gitea) Refresh(ctx context.Context, user *model.User) (bool, error)
- func (c *Gitea) Repo(ctx context.Context, u *model.User, remoteID model.ForgeRemoteID, ...) (*model.Repo, error)
- func (c *Gitea) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error)
- func (c *Gitea) Status(ctx context.Context, user *model.User, repo *model.Repo, ...) error
- func (c *Gitea) TeamPerm(_ *model.User, _ string) (*model.Perm, error)
- func (c *Gitea) Teams(ctx context.Context, u *model.User) ([]*model.Team, error)
- func (c *Gitea) URL() string
- type Opts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Gitea ¶
type Gitea struct { ClientID string ClientSecret string OAuthHost string SkipVerify bool // contains filtered or unexported fields }
func (*Gitea) Activate ¶
Activate activates the repository by registering post-commit hooks with the Gitea repository.
func (*Gitea) Auth ¶
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 ¶
Deactivate deactivates the repository be removing repository push hooks from the Gitea repository.
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 ¶
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) Netrc ¶
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) 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 (*Gitea) Refresh ¶
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 ¶
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.