Created
May 6, 2015 07:48
-
-
Save jfut/e5c96318ea2a680dcca6 to your computer and use it in GitHub Desktop.
JIRA: Delete spam comments script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import com.atlassian.jira.issue.IssueManager | |
import com.atlassian.jira.issue.MutableIssue | |
import com.atlassian.jira.issue.comments.Comment | |
import com.atlassian.jira.issue.comments.CommentManager | |
String issueKey = 'CHURA-XX' | |
IssueManager issueManager = ComponentAccessor.issueManager | |
CommentManager commentManager = ComponentAccessor.commentManager | |
MutableIssue issue = issueManager.getIssueObject(issueKey) | |
List<Comment> comments = commentManager.getComments(issue) | |
comments.each { comment -> | |
if (comment.body.contains('spam words')) { | |
commentManager.delete(comment) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment