workflow_helpers

package
v0.0.0-...-7426b64 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MasterBranch  = "master"
	StagingBranch = "beta"
	ReleaseBranch = "release"
)
View Source
const JiraStatusInProgress = "In Progress"
View Source
const JiraStatusPending = "Pending"
View Source
const JiraStatusTodo = "To Do"
View Source
const UpdateVersionCommitMessage = "Update version.txt"
View Source
const VersionNextFeasible = "Next Feasible"
View Source
const VersionNextUnscheduled = "Next Unscheduled"
View Source
const VersionedPRPrefix = "Version "

Variables

View Source
var VersionMaster = semver.MustParse("0.0.0")

Functions

func ActiveVersionsOnBranch

func ActiveVersionsOnBranch(ghClient *github.Client, jiraClient *jira.Client, branchName string, dateCutoff time.Time) ([]semver.Version, error)

func BranchHasVersionsGT

func BranchHasVersionsGT(client *github.Client, jiraClient *jira.Client, branchName string, version semver.Version) (bool, error)

func CreateBranch

func CreateBranch(ghClient *github.Client, branchName string, SHA string) error

func CreateFileUpdateCommit

func CreateFileUpdateCommit(ghClient *github.Client, branchName string, path string, contents string, message string) (string, error)

func CreatePR

func CreatePR(ghClient *github.Client, prName, branchName, baseBranch, body string) (*github.PullRequest, error)

func ExtractJiraIssueID

func ExtractJiraIssueID(pr *github.PullRequest) (string, error)

ExtractJiraIssueID tries to extract the jira issue ID from the branch name

func FetchCommitsByRef

func FetchCommitsByRef(ghClient *github.Client, ref string, stop func(commit *github.RepositoryCommit) bool) ([]*github.RepositoryCommit, error)

func FetchCommitsByShaRange

func FetchCommitsByShaRange(ghClient *github.Client, startSha string, stopSha string) ([]*github.RepositoryCommit, error)

func FetchJiraIDsInCommits

func FetchJiraIDsInCommits(commits []*github.RepositoryCommit) []string

func FetchJiraIssue

func FetchJiraIssue(jiraClient *jira.Client, jiraIssueID string) (*jira.Issue, error)

func FetchPR

func FetchPR(ghClient *github.Client, number int) (*github.PullRequest, error)

func FetchPRByTitle

func FetchPRByTitle(ghClient *github.Client, title string) (*github.PullRequest, error)

func FetchPRs

func FetchPRs(ghClient *github.Client, cutoff time.Time, opts *github.PullRequestListOptions) ([]*github.PullRequest, error)

FetchPRs fetches all PRs and iterates over all available pages

func FetchVersionPR

func FetchVersionPR(ghClient *github.Client, assert Assertion, versionToCompare semver.Version) (*github.PullRequest, error)

func FetchVersionPRs

func FetchVersionPRs(ghClient *github.Client, assert Assertion, versionToCompare semver.Version, limit int) ([]*github.PullRequest, error)

func GetCommitsBehind

func GetCommitsBehind(client *github.Client, base, head string) ([]*github.RepositoryCommit, error)

func InitGHClient

func InitGHClient() *github.Client

func InitJiraClient

func InitJiraClient() (*jira.Client, error)

func IsMergedStatus

func IsMergedStatus(status string) bool

func IsVersionBranch

func IsVersionBranch(branchName string) bool

func JqlUnpaged

func JqlUnpaged(client *jira.Client, jql string) ([]jira.Issue, error)

func LabelPR

func LabelPR(ghClient *github.Client, prnumber int, labels []string) error

func NewRateLimitTransport

func NewRateLimitTransport(rt http.RoundTripper, accessToken string) *rateLimitTransport

func ParseJiraKey

func ParseJiraKey(v string) (string, error)

func ParseJiraVersion

func ParseJiraVersion(version string) (semver.Version, error)

func ParseJiraVersionRaw

func ParseJiraVersionRaw(version string) string

func SearchGithubIssues

func SearchGithubIssues(client *github.Client, term string) ([]*github.Issue, error)

func SetPRBody

func SetPRBody(client *github.Client, prnumber int, body string) error

func UpdateJiraFixVersion

func UpdateJiraFixVersion(client *jira.Client, issue *jira.Issue, versionID string) error

func UpdateJiraStatus

func UpdateJiraStatus(client *jira.Client, issue *jira.Issue, statusName string) error

func UpdatePRTargetBranch

func UpdatePRTargetBranch(client *github.Client, prnumber int, targetBranch string) error

func ValidVersionBranch

func ValidVersionBranch(branchName string, version semver.Version) error

func VersionFromPRTitle

func VersionFromPRTitle(title string) (semver.Version, error)

func VersionedBranchName

func VersionedBranchName(version semver.Version) string

func VersionedPRTitle

func VersionedPRTitle(version semver.Version) string

Types

type Assertion

type Assertion string
const (
	AssertLT Assertion = "less than"
	AssertGT           = "greater than"
)

type Version

type Version struct {
	semver.Version
	JiraID string
}

func FetchAvailableVersions

func FetchAvailableVersions(jiraClient *jira.Client) ([]Version, error)

func ParseTargetFixVersion

func ParseTargetFixVersion(issue *jira.Issue, availableVersions []Version) (target Version, original *jira.FixVersion, err error)

Jump to

Keyboard shortcuts

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