util

package
v0.0.0-...-e389aed Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCommitMessage

func BuildCommitMessage() (message string)

BuildCommitMessage generates a commit message from the message and trailers configuration

func BuildTrailers

func BuildTrailers() (trailers []string)

BuildTrailers generates the complete list of trailers from the configuration

func GetCliAuthToken

func GetCliAuthToken() string

GetCliAuthToken tries to get a GitHub token by execing `gh auth token`

func GithubActionsBranch

func GithubActionsBranch() (branch string)

GithubActionsBranch returns the branch name if running in a GitHub Actions environment, or an empty string

func IsBinaryInPath

func IsBinaryInPath(name string) bool

IsBinaryInPath checks if a given binary is available in the PATH

func IsCommitHash

func IsCommitHash(ref string) bool

IsCommitHash returns true if the ref looks like a commit hash

func IsValidRefName

func IsValidRefName(refName string) error

IsValidRefName checks if the ref name matches git ref requirements

func MapValues

func MapValues[T any](m map[string]T) []T

func PrettyJson

func PrettyJson(r any) string

func QualifiedRefName

func QualifiedRefName(refName string, refType string) (string, error)

QualifiedRefName normalizes the ref name to a fully qualified format

func ShortJson

func ShortJson(r any) string

func SliceChain

func SliceChain[T any](slices ...[]T) iter.Seq[T]

Types

type RepositoryContext

type RepositoryContext struct {
	Owner  string
	Name   string
	Branch string
}

func GithubActionsContext

func GithubActionsContext() *RepositoryContext

GithubActionsContext returns repository context if running in a GitHub Actions environment

Jump to

Keyboard shortcuts

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