gh

package
v0.54.3 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGithubServerURL = "https://github.com"

Variables

This section is empty.

Functions

func PushUsingLocalGit added in v0.9.0

func PushUsingLocalGit(ctx context.Context, gitRoot string, addPaths []string, message string) (int, error)

Types

type ArtifactFile added in v0.35.0

type ArtifactFile struct {
	Name      string
	Content   []byte
	CreatedAt time.Time
}

type Gh

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

func New

func New() (*Gh, error)

func (*Gh) Client added in v0.29.0

func (g *Gh) Client() *github.Client

func (*Gh) DetectCurrentBranch added in v0.29.0

func (g *Gh) DetectCurrentBranch(ctx context.Context) (string, error)

func (*Gh) DetectCurrentJobID

func (g *Gh) DetectCurrentJobID(ctx context.Context, owner, repo string) (int64, error)

func (*Gh) DetectCurrentPullRequestNumber added in v0.11.0

func (g *Gh) DetectCurrentPullRequestNumber(ctx context.Context, owner, repo string) (int, error)

func (*Gh) FetchChangedFiles added in v0.53.0

func (g *Gh) FetchChangedFiles(ctx context.Context, owner, repo string) ([]*PullRequestFile, error)

func (*Gh) FetchDefaultBranch added in v0.53.0

func (g *Gh) FetchDefaultBranch(ctx context.Context, owner, repo string) (string, error)

func (*Gh) FetchLatestArtifact added in v0.53.0

func (g *Gh) FetchLatestArtifact(ctx context.Context, owner, repo, name, fp string) (*ArtifactFile, error)

func (*Gh) FetchPullRequest added in v0.53.0

func (g *Gh) FetchPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)

func (*Gh) FetchPullRequestFiles added in v0.53.0

func (g *Gh) FetchPullRequestFiles(ctx context.Context, owner, repo string, number int) ([]*PullRequestFile, error)

func (*Gh) FetchRawRootURL added in v0.53.0

func (g *Gh) FetchRawRootURL(ctx context.Context, owner, repo string) (string, error)

func (*Gh) FetchStepByTime added in v0.53.0

func (g *Gh) FetchStepByTime(ctx context.Context, owner, repo string, jobID int64, t time.Time) (Step, error)

func (*Gh) FetchStepExecutionTimeByTime added in v0.53.0

func (g *Gh) FetchStepExecutionTimeByTime(ctx context.Context, owner, repo string, jobID int64, t time.Time) (time.Duration, error)

func (*Gh) FetchStepsByName added in v0.53.0

func (g *Gh) FetchStepsByName(ctx context.Context, owner, repo string, name string) ([]Step, error)

func (*Gh) IsPrivate added in v0.50.0

func (g *Gh) IsPrivate(ctx context.Context, owner, repo string) (bool, error)

func (*Gh) PushContent

func (g *Gh) PushContent(ctx context.Context, owner, repo, branch, content, cp, message string) error

func (*Gh) PutArtifact added in v0.35.0

func (g *Gh) PutArtifact(ctx context.Context, name, fp string, content []byte) error

func (*Gh) PutComment added in v0.11.0

func (g *Gh) PutComment(ctx context.Context, owner, repo string, n int, comment, key string) error

func (*Gh) PutCommentWithDeletion added in v0.34.0

func (g *Gh) PutCommentWithDeletion(ctx context.Context, owner, repo string, n int, comment, key string) error

func (*Gh) ReplaceInsertToBody added in v0.43.0

func (g *Gh) ReplaceInsertToBody(ctx context.Context, owner, repo string, number int, content, key string) error

func (*Gh) SetClient added in v0.29.0

func (g *Gh) SetClient(client *github.Client)

type GitHubEvent added in v0.13.0

type GitHubEvent struct {
	Name    string
	Number  int
	State   string
	Payload any
}

func DecodeGitHubEvent added in v0.13.0

func DecodeGitHubEvent() (*GitHubEvent, error)

type PullRequest added in v0.42.0

type PullRequest struct {
	Number  int
	IsDraft bool
	Labels  []string
}

type PullRequestFile added in v0.19.0

type PullRequestFile struct {
	Filename string
	BlobURL  string
}

type Repository added in v0.28.0

type Repository struct {
	Owner string
	Repo  string
	Path  string
}

func Parse added in v0.28.0

func Parse(raw string) (*Repository, error)

func (*Repository) Reponame added in v0.28.0

func (r *Repository) Reponame() string

type Step added in v0.10.0

type Step struct {
	Name        string
	StartedAt   time.Time
	CompletedAt time.Time
}

Jump to

Keyboard shortcuts

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