internal

package
v3.0.0-alpha.40 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelNone       = "semver:none"
	LabelPatch      = "semver:patch"
	LabelMinor      = "semver:minor"
	LabelBreaking   = "semver:breaking"
	LabelStable     = "semver:stable"
	LabelPrerelease = "semver:prerelease"
)

Variables

Functions

func AsExitErr

func AsExitErr(err error) *exec.ExitError

func CheckPrereleaseLabel

func CheckPrereleaseLabel(label string, aliases map[string]string) (pre bool, prefix string)

CheckPrereleaseLabel returns true if the label is a prerelease label and the prerelease prefix (the part after the final colon)

func GetGithubRepoFromRemote

func GetGithubRepoFromRemote(dir, remote string) (string, error)

func GetLogger

func GetLogger(ctx context.Context) *slog.Logger

func Ptr

func Ptr[V any](v V) *V

func ResolveLabel

func ResolveLabel(label string, aliases map[string]string) string

func RunCmd

func RunCmd(dir string, env map[string]string, command string, args ...string) (string, error)

func WithLogger

func WithLogger(ctx context.Context, logger *slog.Logger) context.Context

Types

type BasePull

type BasePull struct {
	Number         int
	MergeCommitSha string
	Labels         []string
}

type ChangeLevel

type ChangeLevel int
const (
	ChangeLevelNone ChangeLevel = iota
	ChangeLevelPatch
	ChangeLevelMinor
	ChangeLevelMajor
)

func (ChangeLevel) MarshalJSON

func (l ChangeLevel) MarshalJSON() ([]byte, error)

func (ChangeLevel) String

func (l ChangeLevel) String() string

type CommitComparison

type CommitComparison struct {
	AheadBy  int
	BehindBy int
	Commits  []string
}

type GithubClient

type GithubClient interface {
	ListMergedPullsForCommit(ctx context.Context, owner, repo, sha string) ([]BasePull, error)
	CompareCommits(ctx context.Context, owner, repo, base, head string, count int) (*CommitComparison, error)
	GenerateReleaseNotes(ctx context.Context, owner, repo, tag, prevTag string) (string, error)
	CreateRelease(ctx context.Context, owner, repo, tag, body string, prerelease bool) (*RepoRelease, error)
	UploadAsset(ctx context.Context, uploadURL, filename string) error
	DeleteRelease(ctx context.Context, owner, repo string, id int64) error
	PublishRelease(ctx context.Context, owner, repo string, id int64) error
	GetPullRequest(ctx context.Context, owner, repo string, number int) (*BasePull, error)
	GetPullRequestCommits(ctx context.Context, owner, repo string, number int) ([]string, error)
}

func NewGithubClient

func NewGithubClient(ctx context.Context, baseUrl, token, userAgent string) (GithubClient, error)

type Pull

type Pull struct {
	Number           int         `json:"number"`
	LevelLabels      []string    `json:"labels,omitempty"`
	ChangeLevel      ChangeLevel `json:"change_level"`
	HasPreLabel      bool        `json:"has_pre_label,omitempty"`
	PreReleasePrefix string      `json:"pre_release_prefix,omitempty"`
	HasStableLabel   bool        `json:"has_stable_label,omitempty"`
}

func NewPull

func NewPull(number int, aliases map[string]string, labels ...string) (*Pull, error)

func (Pull) String

func (p Pull) String() string

type RepoRelease

type RepoRelease struct {
	ID        int64
	UploadURL string
}

Directories

Path Synopsis
Package actions is just a struct to represent a github action.yml file.
Package actions is just a struct to represent a github action.yml file.
cmd
Package mock_internal is a generated GoMock package.
Package mock_internal is a generated GoMock package.

Jump to

Keyboard shortcuts

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