github

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Opened      = "opened"
	Synchronize = "synchronize"
	Reopened    = "reopened"
	Closed      = "closed"
	Created     = "created"
)
View Source
const (
	MaxCommentLen = 65536
	ActionBotName = "github-actions"
)
View Source
const (
	ErrorStatus = iota
	FailureStatus
	PendingStatus
	SuccessStatus
)

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

func IsErrAlreadyExists

func IsErrAlreadyExists(err error) bool

func IsErrNotFound

func IsErrNotFound(err error) bool

Types

type Artifact

type Artifact struct {
	ID        int64
	Name      string
	CreatedAt time.Time
}

type Artifacts

type Artifacts map[string]*Artifact

func (Artifacts) Get

func (a Artifacts) Get(name string) *Artifact

type Comment

type Comment struct {
	ID         string
	DatabaseID int64
	Body       string
	Author     struct {
		Login string
	}
	CreatedAt         string
	IsMinimized       bool
	ViewerCanMinimize bool
}

type CommitStatus

type CommitStatus struct {
	Sha       string
	Status    Status
	TargetURL string
	Desc      string
	Context   string
}

type Event

type Event interface {
	Number() int
}

type File

type File struct {
	Name   string
	Status string
}

type Github

type Github interface {
	CreateIssueComment(ctx context.Context, number int, body string) error
	HideIssueComment(ctx context.Context, nodeID string) error
	CreateIssueCommentReaction(ctx context.Context, commentID int64, content string) error
	CreateLabel(ctx context.Context, name, description, color string) error
	DeleteLabel(ctx context.Context, label string) error
	GetLabel(ctx context.Context, label string) (*Label, error)
	ListReviews(ctx context.Context, number int) (Reviews, error)
	ListPullRequestComments(ctx context.Context, number int) ([]*Comment, error)
	ListPullRequestsByLabel(ctx context.Context, label string, limit int) ([]*PullRequest, error)
	FindPullRequestByLabel(ctx context.Context, label string) (*PullRequest, error)
	AddPullRequestLabels(ctx context.Context, number int, labels []string) error
	ListFiles(ctx context.Context, number int) ([]string, error)
	CreateCommitStatus(ctx context.Context, commitStatus *CommitStatus) error
	GetPullRequest(ctx context.Context, number int) (*PullRequest, error)
	MultiGetArtifactsByNames(ctx context.Context, names []string) (Artifacts, error)
	DownloadArtifact(ctx context.Context, id int64, file io.Writer) error
	DeleteArtifactsByNames(ctx context.Context, names []string) error
	Event() (Event, error)
}

func New

func New(ctx context.Context, token, owner, repo string) (Github, error)

type IssueComment

type IssueComment struct {
	NodeID string
}

type IssueCommentEvent

type IssueCommentEvent struct {
	githubv3.IssueCommentEvent
}

func (*IssueCommentEvent) Number

func (e *IssueCommentEvent) Number() int

type Label

type Label struct {
	Name        string
	Description string
}

type PullRequest

type PullRequest struct {
	ID             int64
	Number         int
	Title          string
	CreatedAt      time.Time
	HeadSHA        string
	MergeableState string
	Labels         []*Label
}

func (*PullRequest) HasLabel

func (p *PullRequest) HasLabel(labelName string) bool

func (*PullRequest) IsMergeable

func (p *PullRequest) IsMergeable() bool

IsMergeable See: https://github.com/octokit/octokit.net/issues/1763

type PullRequestEvent

type PullRequestEvent struct {
	githubv3.PullRequestEvent
}

func (*PullRequestEvent) Number

func (e *PullRequestEvent) Number() int

type Review

type Review struct {
	UserLogin string
	State     string
}

type Reviews

type Reviews []*Review

func (Reviews) Approves

func (rs Reviews) Approves() int

type Status

type Status int

func (Status) String

func (s Status) String() string

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
sdk
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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