github

package
v0.0.0-...-abe4f24 Latest Latest
Warning

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

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

Documentation

Overview

temporary until this is used by the cli nolint,used,deadcode

Index

Constants

View Source
const (
	SHA1SignatureHeader   = "X-Hub-Signature"
	SHA256SignatureHeader = "X-Hub-Signature-256"
	EventTypeHeader       = "X-Github-Event"
	DeliveryIDHeader      = "X-Github-Delivery"
)

Variables

This section is empty.

Functions

func GenerateMAC

func GenerateMAC(message, key []byte, hashFunc func() hash.Hash) []byte

Types

type APIClient

type APIClient struct {
	Host   string // example: api.github.com
	Config *env.Config
	Client *http.Client
}

func NewApiClient

func NewApiClient(config env.Config) *APIClient

func (*APIClient) NewAccessToken

func (a *APIClient) NewAccessToken(installationID int64) (AccessToken, error)

type AccessToken

type AccessToken struct {
	Token     string `json:"token"`
	ExpiresAt string `json:"expires_at"`
}

type Action

type Action int
const (
	Comment Action = iota
	Opened  Action = iota
)

func (Action) String

func (e Action) String() string

type Actor

type Actor struct {
	Name string
}

type Commenter

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

func NewCommenter

func NewCommenter(client *github.Client, log logging.SimpleLogging, ctx context.Context) *Commenter

func (*Commenter) Comment

func (c *Commenter) Comment(event *Event, comment *string) error

func (*Commenter) Plan

func (c *Commenter) Plan(event *Event, app string, command string, comment string) error

type CommitState

type CommitState int
const (
	PendingCommitState CommitState = iota
	SuccessCommitState
	FailedCommitState
)

func (CommitState) String

func (s CommitState) String() string

type Event

type Event struct {
	Revision             string
	Message              string
	IsPullRequest        bool
	Action               Action
	Actor                Actor
	Repository           Repository
	PullRequest          PullRequest
	InstallationProvider InstallationProvider
	GithubClient         *github.Client
}

func InitializeFromIssueComment

func InitializeFromIssueComment(source github.IssueCommentEvent, revision string) (Event, *int64)

func InitializeFromPullRequest

func InitializeFromPullRequest(source github.PullRequestEvent) Event

func (*Event) GetInstallation

func (e *Event) GetInstallation() *github.Installation

func (*Event) HasMessage

func (e *Event) HasMessage() bool

type GitClient

type GitClient struct {
	Config        env.Config
	Token         AccessToken
	Command       cmd.Command
	GitBinaryPath string
	Host          string
}

func NewGitClient

func NewGitClient(config env.Config, token AccessToken) *GitClient

func (*GitClient) Clone

func (g *GitClient) Clone(org string, repo string, path string) error

type GithubEvent

type GithubEvent struct {
	Action *string `json:"action,omitempty"`
}

type GithubPullRequestStatusFetcher

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

func (*GithubPullRequestStatusFetcher) Fetch

func (*GithubPullRequestStatusFetcher) PullIsApproved

func (g *GithubPullRequestStatusFetcher) PullIsApproved(ctx context.Context, event Event) (approvalStatus models.ApprovalStatus, err error)

func (*GithubPullRequestStatusFetcher) PullIsMergeable

func (g *GithubPullRequestStatusFetcher) PullIsMergeable(ctx context.Context, event Event, vcsstatusname string) (bool, error)

type InstallationProvider

type InstallationProvider interface {
	GetInstallation() *github.Installation
}

type PullRequest

type PullRequest struct {
	Number int
}

type PullRequestReviewDecision

type PullRequestReviewDecision struct {
	Data struct {
		Repository struct {
			PullRequest struct {
				ReviewDecision string `json:"reviewDecision"`
			} `json:"pullRequest"`
		} `json:"repository"`
	} `json:"data"`
}

func (*PullRequestReviewDecision) Approved

func (p *PullRequestReviewDecision) Approved() bool

type Repository

type Repository struct {
	Name  string
	Owner string
}

func (*Repository) HtmlUrl

func (r *Repository) HtmlUrl() string

type VscClient

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

func NewClient

func NewClient(client *github.Client, logger logging.SimpleLogging) *VscClient

func (*VscClient) GetPullReviewDecision

func (v *VscClient) GetPullReviewDecision(event Event) (approvalStatus bool, err error)

func (*VscClient) SetStatusCheck

func (v *VscClient) SetStatusCheck(ctx context.Context, event Event, state CommitState, context string, description string, url string) error

type VscCommenter

type VscCommenter interface {
	Plan(event *Event, app string, command string, comment string)
	Comment(event *Event, comment *string)
}

type VscPullRequestStatusFetcher

type VscPullRequestStatusFetcher interface {
	Fetch(ctx context.Context, event Event) (models.PullRequestStatus, error)
}

func NewPullRequestStatusFetcher

func NewPullRequestStatusFetcher(logger logging.SimpleLogging, client *github.Client) VscPullRequestStatusFetcher

Jump to

Keyboard shortcuts

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