github

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CommentsPrefix = "The following is the coverage report on the affected files."

CommentsPrefix is the prefix when commenting on Github Pull Requests It is also the flag when checking whether the target comment exists or not to avoid duplicate

Variables

This section is empty.

Functions

func GenCommentContent

func GenCommentContent(commentPrefix string, delta cover.DeltaCovList) string

GenCommentContent generate github comment content based on diff coverage and commentFlag

Types

type GitPrComment added in v1.2.2

type GitPrComment struct {
	RobotUserName string
	RepoOwner     string
	RepoName      string
	CommentFlag   string
	PrNumber      int
	Ctx           context.Context

	GithubClient *github.Client
	// contains filtered or unexported fields
}

GitPrComment is the entry which is able to comment on Github Pull Requests

func NewPrClient

func NewPrClient(githubTokenPath, repoOwner, repoName, prNumStr, botUserName, commentFlag string) *GitPrComment

NewPrClient creates an Client which be able to comment on Github Pull Request

func (*GitPrComment) CreateGithubComment added in v1.2.2

func (c *GitPrComment) CreateGithubComment(commentPrefix string, diffCovList cover.DeltaCovList) (err error)

CreateGithubComment post github comment of diff coverage

func (*GitPrComment) EraseHistoryComment added in v1.2.2

func (c *GitPrComment) EraseHistoryComment(commentPrefix string) error

EraseHistoryComment erase history similar comment before post again

func (*GitPrComment) GetCommentFlag added in v1.2.2

func (c *GitPrComment) GetCommentFlag() string

GetCommentFlag get CommentFlag from the GitPrComment

func (*GitPrComment) GetPrChangedFiles added in v1.2.2

func (c *GitPrComment) GetPrChangedFiles() (files []string, err error)

GetPrChangedFiles get github pull request changes file list

func (*GitPrComment) PostComment added in v1.2.2

func (c *GitPrComment) PostComment(content, commentPrefix string) error

PostComment post comment on github. It erased the old one if existed to avoid duplicate

type PrComment

type PrComment interface {
	CreateGithubComment(commentPrefix string, diffCovList cover.DeltaCovList) (err error)
	PostComment(content, commentPrefix string) error
	EraseHistoryComment(commentPrefix string) error
	GetPrChangedFiles() (files []string, err error)
	GetCommentFlag() string
}

PrComment is the interface of the entry which is able to comment on Github Pull Requests

Jump to

Keyboard shortcuts

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