import com.atlassian.jira.component.ComponentAccessor
import com.opensymphony.workflow.InvalidInputException;
import com.atlassian.jira.issue.comments.CommentManager;
import com.atlassian.jira.issue.comments.Comment;
//获取备注管理器
CommentManager commentManager = ComponentAccessor.getCommentManager();
//根据issue获取所有备注信息
List commentList = commentManager.getComments($issue)
for(Comment comment : commentList){
//如果备注提交人等于qualitytest且内容包含指定信息则校验通过,否则校验失败
if(comment.getAuthorFullName().equals("qualitytest")&&
comment.getBody().contains("本次Gitlab与Jira关联的信息如下")){
return true;
}
} //---一定要返回true、false或者抛出异常,否则会报空指针。如下图
throw new InvalidInputException("缺陷备注中缺少修改gitlab相关信息");
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删