Documentation ¶
Index ¶
- func New(opts Opts) (forge.Forge, error)
- type Forgejo
- func (c *Forgejo) Activate(ctx context.Context, u *model.User, r *model.Repo, link string) error
- func (c *Forgejo) Auth(ctx context.Context, token, _ string) (string, error)
- func (c *Forgejo) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (*model.Commit, error)
- func (c *Forgejo) Branches(ctx context.Context, u *model.User, r *model.Repo, p *model.ListOptions) ([]string, error)
- func (c *Forgejo) Deactivate(ctx context.Context, u *model.User, r *model.Repo, link string) error
- func (c *Forgejo) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]*forge_types.FileMeta, error)
- func (c *Forgejo) File(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]byte, error)
- func (c *Forgejo) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error)
- func (c *Forgejo) Login(ctx context.Context, req *forge_types.OAuthRequest) (*model.User, string, error)
- func (c *Forgejo) Name() string
- func (c *Forgejo) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error)
- func (c *Forgejo) Org(ctx context.Context, u *model.User, owner string) (*model.Org, error)
- func (c *Forgejo) OrgMembership(ctx context.Context, u *model.User, owner string) (*model.OrgPerm, error)
- func (c *Forgejo) PullRequests(ctx context.Context, u *model.User, r *model.Repo, p *model.ListOptions) ([]*model.PullRequest, error)
- func (c *Forgejo) Refresh(ctx context.Context, user *model.User) (bool, error)
- func (c *Forgejo) Repo(ctx context.Context, u *model.User, remoteID model.ForgeRemoteID, ...) (*model.Repo, error)
- func (c *Forgejo) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error)
- func (c *Forgejo) Status(ctx context.Context, user *model.User, repo *model.Repo, ...) error
- func (c *Forgejo) TeamPerm(_ *model.User, _ string) (*model.Perm, error)
- func (c *Forgejo) Teams(ctx context.Context, u *model.User) ([]*model.Team, error)
- func (c *Forgejo) URL() string
- type Opts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Forgejo ¶
type Forgejo struct { ClientID string ClientSecret string SkipVerify bool // contains filtered or unexported fields }
func (*Forgejo) Activate ¶
Activate activates the repository by registering post-commit hooks with the Forgejo repository.
func (*Forgejo) Auth ¶
Auth uses the Forgejo oauth2 access token and refresh token to authenticate a session and return the Forgejo account login.
func (*Forgejo) BranchHead ¶
func (c *Forgejo) 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 (*Forgejo) Branches ¶
func (c *Forgejo) 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 (*Forgejo) Deactivate ¶
Deactivate deactivates the repository be removing repository push hooks from the Forgejo repository.
func (*Forgejo) File ¶
func (c *Forgejo) File(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]byte, error)
File fetches the file from the Forgejo repository and returns its contents.
func (*Forgejo) Hook ¶
Hook parses the incoming Forgejo hook and returns the Repository and Pipeline details. If the hook is unsupported nil values are returned.
func (*Forgejo) Login ¶
func (c *Forgejo) Login(ctx context.Context, req *forge_types.OAuthRequest) (*model.User, string, error)
Login authenticates an account with Forgejo using basic authentication. The Forgejo account details are returned when the user is successfully authenticated.
func (*Forgejo) Netrc ¶
Netrc returns a netrc file capable of authenticating Forgejo requests and cloning Forgejo repositories. The netrc will use the global machine account when configured.
func (*Forgejo) OrgMembership ¶
func (c *Forgejo) 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 (*Forgejo) PullRequests ¶
func (*Forgejo) Refresh ¶
Refresh refreshes the Forgejo oauth2 access token. If the token is refreshed, the user is updated and a true value is returned.
func (*Forgejo) Repo ¶
func (c *Forgejo) Repo(ctx context.Context, u *model.User, remoteID model.ForgeRemoteID, owner, name string) (*model.Repo, error)
Repo returns the Forgejo repository.
func (*Forgejo) Repos ¶
Repos returns a list of all repositories for the Forgejo account, including organization repositories.
func (*Forgejo) Status ¶
func (c *Forgejo) Status(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, workflow *model.Workflow) error
Status is supported by the Forgejo driver.