本文整理匯總了Golang中github.com/crosbymichael/octokat.Client.AddComment方法的典型用法代碼示例。如果您正苦於以下問題:Golang Client.AddComment方法的具體用法?Golang Client.AddComment怎麽用?Golang Client.AddComment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/crosbymichael/octokat.Client
的用法示例。
在下文中一共展示了Client.AddComment方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: addComment
// add the comment if it does not exist already
func addComment(gh *octokat.Client, repo octokat.Repo, prNum, comment, commentType string) error {
// get the comments
comments, err := gh.Comments(repo, prNum, &octokat.Options{})
if err != nil {
return err
}
// check if we already made the comment
for _, c := range comments {
// if we already made the comment return nil
if strings.ToLower(c.User.Login) == "gordontheturtle" && strings.Contains(c.Body, commentType) {
logrus.Debugf("Already made comment about %q on PR %s", commentType, prNum)
return nil
}
}
// add the comment because we must not have already made it
if _, err := gh.AddComment(repo, prNum, comment); err != nil {
return err
}
logrus.Infof("Would have added comment about %q PR %s", commentType, prNum)
return nil
}