Documentation
¶
Overview ¶
Package common is used to share common code between all VCS clients without running into circular dependency issues.
Index ¶
- Variables
- func AutomergeCommitMsg(pullNum int) string
- func DisableSSLVerification() func()
- func GenerateSeparators(command string) map[ClosureType]SeparatorSet
- func SetGitScopeTags(scope tally.Scope, repoFullName string, pullNum int) tally.Scope
- func SplitComment(logger logging.SimpleLogging, comment string, maxSize int, ...) []string
- func ValidateSignature(payload []byte, signature string, secretKey []byte) error
- func WriteGitCreds(gitUser string, gitToken string, gitHostname string, home string, ...) error
- type ClosureType
- type InstrumentedClient
- func (c *InstrumentedClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, ...) error
- func (c *InstrumentedClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
- func (c *InstrumentedClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, ...) error
- func (c *InstrumentedClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, ...) error
- func (c *InstrumentedClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error)
- func (c *InstrumentedClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) (models.MergeableStatus, error)
- func (c *InstrumentedClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, ...) error
- func (c *InstrumentedClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) error
- type SeparatorSet
Constants ¶
This section is empty.
Variables ¶
var GenerateSeparatorsFunc = GenerateSeparators
GenerateSeparatorsFunc is a variable that holds the separator generation function This allows it to be overridden for testing
Functions ¶
func AutomergeCommitMsg ¶ added in v0.4.14
AutomergeCommitMsg returns the commit message to use when automerging.
func DisableSSLVerification ¶ added in v0.39.0
func DisableSSLVerification() func()
disableSSLVerification disables ssl verification for the global http client and returns a function to be called in a defer that will re-enable it.
func GenerateSeparators ¶ added in v0.41.0
func GenerateSeparators(command string) map[ClosureType]SeparatorSet
GenerateSeparators creates separator sets for different closure types
func SetGitScopeTags ¶ added in v0.39.0
func SplitComment ¶
func SplitComment(logger logging.SimpleLogging, comment string, maxSize int, maxCommentsPerCommand int, command string) []string
SplitComment splits comment into a slice of comments that are under maxSize. - It appends appropriate SepEnd to all comments that have a following comment based on closure type. - It prepends appropriate SepStart to all comments that have a preceding comment based on closure type. - If maxCommentsPerCommand is non-zero, it never returns more than maxCommentsPerCommand comments, and it truncates the beginning of the comment to preserve the end of the comment string, which usually contains more important information, such as warnings, errors, and the plan summary. - SplitComment prepends the appropriate TruncationHeader to the first comment if it would have produced more comments.
func ValidateSignature ¶ added in v0.39.0
func WriteGitCreds ¶ added in v0.39.0
func WriteGitCreds(gitUser string, gitToken string, gitHostname string, home string, logger logging.SimpleLogging, ghAccessToken bool) error
WriteGitCreds generates a .git-credentials file containing the username and token used for authenticating with git over HTTPS It will create the file in home/.git-credentials If ghAccessToken is true we will look for a line starting with https://x-access-token and ending with gitHostname and replace it.
Types ¶
type ClosureType ¶ added in v0.41.0
type ClosureType int
ClosureType represents the type of markdown closure at a given position
const ( // NoClosure means no special closure is needed NoClosure ClosureType = iota // CodeBlock means we're inside a code block (“`) CodeBlock // DetailsBlock means we're inside a details block (<details>) DetailsBlock // CodeInDetails means we're inside a code block within a details block CodeInDetails // InlineCode means we're inside an inline code block (`) InlineCode )
type InstrumentedClient ¶ added in v0.39.0
func (*InstrumentedClient) CreateComment ¶ added in v0.39.0
func (c *InstrumentedClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, command string) error
func (*InstrumentedClient) GetModifiedFiles ¶ added in v0.39.0
func (c *InstrumentedClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
func (*InstrumentedClient) HidePrevCommandComments ¶ added in v0.39.0
func (c *InstrumentedClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, dir string) error
func (*InstrumentedClient) MergePull ¶ added in v0.39.0
func (c *InstrumentedClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, pullOptions models.PullRequestOptions) error
func (*InstrumentedClient) PullIsApproved ¶ added in v0.39.0
func (c *InstrumentedClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error)
func (*InstrumentedClient) PullIsMergeable ¶ added in v0.39.0
func (c *InstrumentedClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, vcsstatusname string, ignoreVCSStatusNames []string) (models.MergeableStatus, error)
func (*InstrumentedClient) ReactToComment ¶ added in v0.39.0
func (c *InstrumentedClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, reaction string) error
func (*InstrumentedClient) UpdateStatus ¶ added in v0.39.0
func (c *InstrumentedClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, state models.CommitStatus, src string, description string, url string) error
type SeparatorSet ¶ added in v0.41.0
SeparatorSet contains the separators for a specific closure type