forgejo

package
v2.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 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 Forgejo, an open source Git service written in Go. See https://forgejo.org/

Types

type Forgejo

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

func (*Forgejo) Activate

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

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

func (*Forgejo) Auth

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

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

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

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

func (*Forgejo) Dir

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

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

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

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

func (*Forgejo) Name

func (c *Forgejo) Name() string

Name returns the string name of this driver.

func (*Forgejo) Netrc

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

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) Org

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

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 (c *Forgejo) PullRequests(ctx context.Context, u *model.User, r *model.Repo, p *model.ListOptions) ([]*model.PullRequest, error)

func (*Forgejo) Refresh

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

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

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

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.

func (*Forgejo) TeamPerm

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

TeamPerm is not supported by the Forgejo driver.

func (*Forgejo) Teams

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

Teams is supported by the Forgejo driver.

func (*Forgejo) URL

func (c *Forgejo) URL() string

URL returns the root url of a configured forge.

type Opts

type Opts struct {
	URL        string // Forgejo server url.
	OAuth2URL  string // User-facing Forgejo server url for OAuth2.
	Client     string // OAuth2 Client ID
	Secret     string // OAuth2 Client Secret
	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