Documentation ¶
Index ¶
- Constants
- func GenCommentContent(commentPrefix string, delta cover.DeltaCovList) string
- type GitPrComment
- func (c *GitPrComment) CreateGithubComment(commentPrefix string, diffCovList cover.DeltaCovList) (err error)
- func (c *GitPrComment) EraseHistoryComment(commentPrefix string) error
- func (c *GitPrComment) GetCommentFlag() string
- func (c *GitPrComment) GetPrChangedFiles() (files []string, err error)
- func (c *GitPrComment) PostComment(content, commentPrefix string) error
- type PrComment
Constants ¶
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 ¶
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 ¶
func (c *GitPrComment) CreateGithubComment(commentPrefix string, diffCovList cover.DeltaCovList) (err error)
CreateGithubComment post github comment of diff coverage
func (*GitPrComment) EraseHistoryComment ¶
func (c *GitPrComment) EraseHistoryComment(commentPrefix string) error
EraseHistoryComment erase history similar comment before post again
func (*GitPrComment) GetCommentFlag ¶
func (c *GitPrComment) GetCommentFlag() string
GetCommentFlag get CommentFlag from the GitPrComment
func (*GitPrComment) GetPrChangedFiles ¶
func (c *GitPrComment) GetPrChangedFiles() (files []string, err error)
GetPrChangedFiles get github pull request changes file list
func (*GitPrComment) PostComment ¶
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