prow/github/client.go
func (c *Client) DeleteStaleComments(org, repo string, number int, comments []IssueComment, isStale func(IssueComment) bool) error {
	var err error
	if comments == nil {
		comments, err = c.ListIssueComments(org, repo, number)
		if err != nil {
			return fmt.Errorf("failed to list comments while deleting stale comments. err: %v", err)
		}
	}
	for _, comment := range comments {
		if isStale(comment) {
			if err := c.DeleteComment(org, repo, comment.ID); err != nil {
				return fmt.Errorf("failed to delete stale comment with ID '%d'", comment.ID)
			}
		}
	}
	return nil
}
func (c *Client) DeleteStaleComments(org, repo string, number int, comments []IssueComment, isStale func(IssueComment) bool) error {
	var err error
	if comments == nil {
		comments, err = c.ListIssueComments(org, repo, number)
		if err != nil {
			return fmt.Errorf("failed to list comments while deleting stale comments. err: %v", err)
		}
	}
	for _, comment := range comments {
		if isStale(comment) {
			if err := c.DeleteComment(org, repo, comment.ID); err != nil {
				return fmt.Errorf("failed to delete stale comment with ID '%d'", comment.ID)
			}
		}
	}
	return nil
}
func ( c * Client ) DeleteStaleComments ( org , repo string , number int , comments [ ] IssueComment , isStale func ( IssueComment ) bool ) error { var err error if comments == nil { comments , err = c . ListIssueComments ( org , repo , number ) if err != nil { return fmt . Errorf ( " " , err ) } } for _ , comment := range comments { if isStale ( comment ) { if err := c . DeleteComment ( org , repo , comment . ID ) ; err != nil { return fmt . Errorf ( " " , comment . ID ) } } } return nil }
// DeleteStaleComments iterates over comments on an issue/PR, deleting those which the 'isStale'
// function identifies as stale. If 'comments' is nil, the comments will be fetched from GitHub.
DeleteStaleComments iterates over comments on an issue / PR deleting those which the isStale function identifies as stale . If comments is nil the comments will be fetched from GitHub .