pkg

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const CommentEndMarker = "Comment from [gogit](https://github.com/linuxsuren/gogit)."

CommentEndMarker is the identify for matching existing comment

Variables

This section is empty.

Functions

func CreateComment added in v0.0.5

func CreateComment(ctx context.Context, repoInfo RepoInformation, message, identity string) (err error)

CreateComment creates a comment against the pull request

It will update the comment there is a comment has the same ender

func CreateStatus added in v0.0.5

func CreateStatus(ctx context.Context, repoInfo RepoInformation) (err error)

CreateStatus is the main entry of this reconciler

func IgnoreError added in v0.0.13

func IgnoreError(err error, msg string) error

func WrapError added in v0.0.13

func WrapError(err error, msg string, args ...any) error

Types

type RepoInformation

type RepoInformation struct {
	Provider string
	Server   string
	Owner    string
	Repo     string
	PrNumber int

	Username, Token string

	Status      string
	Target      string
	Label       string
	Description string
}

func (RepoInformation) GetRepoPath added in v0.0.14

func (r RepoInformation) GetRepoPath() string

GetRepoPath returns the repository path

func (RepoInformation) String added in v0.0.14

func (r RepoInformation) String() string

String returns the human-readable string

type StatusMaker

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

StatusMaker responsible for Pull Requests status creating

func NewMaker added in v0.0.5

func NewMaker(ctx context.Context, repoInfo RepoInformation) (maker *StatusMaker)

NewMaker creates a maker

func NewStatusMaker

func NewStatusMaker(repo, token string) *StatusMaker

NewStatusMaker creates an instance of statusMaker

func (*StatusMaker) CreateComment added in v0.0.5

func (s *StatusMaker) CreateComment(ctx context.Context, message, endMarker string) (err error)

CreateComment creates a comment

func (*StatusMaker) CreateStatus added in v0.0.5

func (s *StatusMaker) CreateStatus(ctx context.Context, status scm.State, label, desc string) (err error)

CreateStatus creates a generic status

func (*StatusMaker) FindPreviousStatus

func (s *StatusMaker) FindPreviousStatus(ctx context.Context, scmClient *scm.Client, sha, label string) (target *scm.Status, err error)

FindPreviousStatus finds the existing status by sha and label

func (*StatusMaker) ListStatus added in v0.0.7

func (s *StatusMaker) ListStatus(ctx context.Context, label, desc string) (err error)

ListStatus list the status

func (*StatusMaker) WithExpirationCheck

func (s *StatusMaker) WithExpirationCheck(check expirationCheckFunc) *StatusMaker

WithExpirationCheck set the expiration check function

func (*StatusMaker) WithPR

func (s *StatusMaker) WithPR(pr int) *StatusMaker

WithPR sets the pr number

func (*StatusMaker) WithProvider

func (s *StatusMaker) WithProvider(provider string) *StatusMaker

WithProvider sets the Provider

func (*StatusMaker) WithServer

func (s *StatusMaker) WithServer(server string) *StatusMaker

WithServer sets the server

func (*StatusMaker) WithTarget

func (s *StatusMaker) WithTarget(target string) *StatusMaker

WithTarget sets the Target URL

func (*StatusMaker) WithToken

func (s *StatusMaker) WithToken(token string) *StatusMaker

WithToken sets the token

func (*StatusMaker) WithUsername

func (s *StatusMaker) WithUsername(username string) *StatusMaker

WithUsername sets the username

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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