models

package
v0.0.0-...-afcaf83 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangedFileObject

type ChangedFileObject struct {
	Path string
}

ChangedFileObject represents the GraphQL FilesChanged node. https://developer.github.com/v4/object/pullrequestchangedfile/

type CommitObject

type CommitObject struct {
	ID            string
	OID           string
	CommittedDate githubv4.DateTime
	Message       string
	Author        struct {
		User struct {
			Login string
		}
		Email string
	}
}

CommitObject represents the GraphQL commit node. https://developer.github.com/v4/object/commit/

type CommonConfig

type CommonConfig struct {
	AccessToken         string `json:"access_token"`
	SkipSSLVerification bool   `json:"skip_ssl_verification"`
}

type Git

type Git interface {
	Init(*string) error
	Pull(string, string, int, bool, bool) error
	RevParse(string) (string, error)
	RevList(*string, []string, []string, bool) ([]string, error)
	Fetch(string, int, int, bool, bool) error
	Checkout(string, string, bool) error
	Merge(string, bool) error
	Rebase(string, string, bool) error
	GitCryptUnlock(string) error
}

Git interface for testing purposes.

type GitClient

type GitClient struct {
	AccessToken string
	Directory   string
	Output      io.Writer
}

GitClient ...

func NewGitClient

func NewGitClient(common CommonConfig, disableGitLFS bool, dir string, output io.Writer) (*GitClient, error)

func (*GitClient) Checkout

func (g *GitClient) Checkout(branch, sha string, submodules bool) error

CheckOut

func (*GitClient) Endpoint

func (g *GitClient) Endpoint(uri string) (string, error)

Endpoint takes an uri and produces an endpoint with the login information baked in.

func (*GitClient) Fetch

func (g *GitClient) Fetch(uri string, prNumber int, depth int, submodules bool, checkout bool) error

func (*GitClient) GitCryptUnlock

func (g *GitClient) GitCryptUnlock(base64key string) error

GitCryptUnlock unlocks the repository using git-crypt

func (*GitClient) Init

func (g *GitClient) Init(branch *string) error

func (*GitClient) Merge

func (g *GitClient) Merge(sha string, submodules bool) error

Merge ...

func (*GitClient) Pull

func (g *GitClient) Pull(uri, branch string, depth int, submodules bool, fetchTags bool) error

Pull ...

func (*GitClient) Rebase

func (g *GitClient) Rebase(baseRef string, headSha string, submodules bool) error

Rebase ...

func (*GitClient) RevList

func (g *GitClient) RevList(fromCommit *string, paths []string, ignorePaths []string, disableCISkip bool) ([]string, error)

RevList retrieves the list of commits starting with (and including) fromCommit (if it exists) in chronological order. If fromCommit is empty or does not exist in the repo, only the latest commit will be returned.

It also

func (*GitClient) RevParse

func (g *GitClient) RevParse(branch string) (string, error)

RevParse retrieves the SHA of the given branch.

type Github

type Github interface {
	ListPullRequests([]githubv4.PullRequestState) ([]*PullRequest, error)
	GetPullRequest(int, string) (*PullRequest, error)
	ListModifiedFiles(int) ([]string, error)
	PostComment(int, string) error
	UpdateCommitStatus(string, string, string, string, string, string) error
	DeletePreviousComments(int) error
}

Github for testing purposes.

type GithubClient

type GithubClient struct {
	HostingEndpoint string
	V3              *github.Client
	V4              *githubv4.Client
	Repository      string
	Owner           string
}

GithubClient for handling requests to the Github V3 and V4 APIs.

func NewGithubClient

func NewGithubClient(common CommonConfig, config GithubConfig) (*GithubClient, error)

NewGithubClient ...

func (*GithubClient) DeletePreviousComments

func (m *GithubClient) DeletePreviousComments(prNumber int) error

func (*GithubClient) GetPullRequest

func (m *GithubClient) GetPullRequest(prNumber int, commitRef string) (*PullRequest, error)

GetPullRequest ...

func (*GithubClient) ListModifiedFiles

func (m *GithubClient) ListModifiedFiles(prNumber int) ([]string, error)

ListModifiedFiles in a pull request (not supported by V4 API).

func (*GithubClient) ListPullRequests

func (m *GithubClient) ListPullRequests(prStates []githubv4.PullRequestState) ([]*PullRequest, error)

ListPullRequests gets the last commit on all pull requests with the matching state.

func (*GithubClient) PostComment

func (m *GithubClient) PostComment(prNumber int, comment string) error

PostComment to a pull request or issue.

func (*GithubClient) UpdateCommitStatus

func (m *GithubClient) UpdateCommitStatus(commitRef, baseContext, statusContext, status, targetURL, description string) error

UpdateCommitStatus for a given commit (not supported by V4 API).

type GithubConfig

type GithubConfig struct {
	Repository      string `json:"repository"`
	HostingEndpoint string `json:"hosting_endpoint"`
	V3Endpoint      string `json:"v3_endpoint"`
	V4Endpoint      string `json:"v4_endpoint"`
}

func (GithubConfig) RepositoryURL

func (config GithubConfig) RepositoryURL() string

type LabelObject

type LabelObject struct {
	Name string
}

LabelObject represents the GraphQL label node. https://developer.github.com/v4/object/label

type Metadata

type Metadata []*MetadataField

Metadata output from get/put steps.

func (*Metadata) Add

func (m *Metadata) Add(name, value string)

Add a MetadataField to the Metadata.

type MetadataField

type MetadataField struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

MetadataField ...

type PullRequest

type PullRequest struct {
	PullRequestObject
	Tip                 CommitObject
	ApprovedReviewCount int
	Labels              []LabelObject
}

PullRequest represents a pull request and includes the tip (commit).

func (*PullRequest) UpdatedDate

func (p *PullRequest) UpdatedDate() githubv4.DateTime

UpdatedDate returns the last time a PR was updated, either by commit or being closed/merged.

type PullRequestObject

type PullRequestObject struct {
	ID          string
	Number      int
	Title       string
	URL         string
	BaseRefName string
	HeadRefName string
	Repository  struct {
		URL string
	}
	IsCrossRepository bool
	IsDraft           bool
	State             githubv4.PullRequestState
	ClosedAt          githubv4.DateTime
	MergedAt          githubv4.DateTime
}

PullRequestObject represents the GraphQL commit node. https://developer.github.com/v4/object/pullrequest/

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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