github

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const PULLREQUESTBODY = `

## Report

{{ .Report }}

## Changelog

<details><summary>Click to expand</summary>

` + "```\n{{ .Description }}\n```" + `

</details>

## Remark

This pull request was automatically created using [Updatecli](https://www.updatecli.io).

Please report any issues with this tool [here](https://github.com/updatecli/updatecli/issues/new)

`

PULLREQUESTBODY is the pull request template used as pull request description Please note that triple backticks are concatenated with the literals, as they cannot be escaped

Variables

This section is empty.

Functions

func SetBody

func SetBody(changelog Changelog) (body string, err error)

SetBody generates the body pull request based on PULLREQUESTBODY

Types

type Changelog

type Changelog struct {
	Title       string
	Description string
	Report      string
}

Changelog contains various information used to describe target changes

type Github

type Github struct {
	Owner                  string
	Description            string
	PullRequestDescription Changelog
	Repository             string
	Username               string
	Token                  string
	URL                    string
	Version                string         // **Deprecated** Version is deprecated in favor of `versionFilter.pattern`, this field will be removed in a futur version
	VersionFilter          version.Filter //VersionFilter provides parameters to specify version pattern and its type like regex, semver, or just latest.
	Directory              string
	Branch                 string

	User          string
	Email         string
	Force         bool          // Force is used during the git push phase to run `git push --force`.
	CommitMessage commit.Commit // CommitMessage represents conventional commit metadata as type or scope, used to generate the final commit message.
	// contains filtered or unexported fields
}

Github contains settings to interact with Github

func (*Github) Add

func (g *Github) Add(files []string) error

Add run `git add`.

func (*Github) Changelog

func (g *Github) Changelog(name string) (string, error)

Changelog returns a changelog description based on a release name

func (*Github) Check

func (g *Github) Check() (errs []error)

Check verifies if mandatory Github parameters are provided and return false if not.

func (*Github) Checkout

func (g *Github) Checkout() error

Checkout create and then uses a temporary git branch.

func (*Github) Clean

func (g *Github) Clean() error

Clean deletes github working directory.

func (*Github) Clone

func (g *Github) Clone() (string, error)

Clone run `git clone`.

func (*Github) Commit

func (g *Github) Commit(message string) error

Commit run `git commit`.

func (*Github) GetDirectory

func (g *Github) GetDirectory() (directory string)

GetDirectory returns the local git repository path.

func (*Github) Init

func (g *Github) Init(source string, pipelineID string) error

Init set default Github parameters if not set.

func (*Github) IsPullRequest

func (g *Github) IsPullRequest() (ID string, err error)

IsPullRequest checks if a pull request already exist and is in the state 'open'.

func (*Github) NewClient

func (g *Github) NewClient() *githubv4.Client

NewClient return a new client

func (*Github) OpenPullRequest

func (g *Github) OpenPullRequest() error

OpenPullRequest creates a new pull request.

func (*Github) Push

func (g *Github) Push() error

Push run `git push` then open a pull request on Github if not already created.

func (*Github) PushTag

func (g *Github) PushTag(tag string) error

PushTag push tags

func (*Github) SearchReleases

func (g *Github) SearchReleases() (releases []string, err error)

SearchReleases return every releases from the github api returned in reverse order of created time.

func (*Github) SearchTags

func (g *Github) SearchTags() (tags []string, err error)

SearchTags return every tags from the github api return in reverse order of commit tags.

func (*Github) Source

func (g *Github) Source(workingDir string) (value string, err error)

Source retrieves a specific version tag from Github Releases.

func (*Github) UpdatePullRequest

func (g *Github) UpdatePullRequest(ID string) error

UpdatePullRequest updates an existing pull request.

type PageInfo

type PageInfo struct {
	HasNextPage     bool
	HasPreviousPage bool
	EndCursor       string
	StartCursor     string
}

PageInfo is used for Graphql queries to iterate over pagination

type PullRequest

type PullRequest struct {
	BaseRefName string
	Body        string
	HeadRefName string
	ID          string
	State       string
	Title       string
	Url         string
}

PullRequest contains multiple fields mapped to Github V4 api

type RateLimit

type RateLimit struct {
	Cost      int
	Remaining int
	ResetAt   string
}

RateLimit is a struct that contains Github Api limit information

func (*RateLimit) Show

func (a *RateLimit) Show()

Show display Github Api limit usage

Jump to

Keyboard shortcuts

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