Script Console是运行一次性特别脚本以及学习和试验Jira API的地方。
- 直接在浏览器中输入脚本,并进行直接运行获得结果。
- 或者单击“文件”选项卡,然后键入文件的路径(文件路径是服务器可访问的.groovy文件的绝对路径名。如果提供相对路径名,则文件将相对于脚本根进行解析。
如通script脚本,向一个问题写入备注。
import com.atlassian.jira.component.ComponentAccessor //dispatch an event after creating the comment final boolean dispatchEvent = true // the body of the comment final String commentBody = """The text for your comment, which can include specific values from the issue, such as the specific issue assignee ${issue.assignee?.name ?: 'Unassigned'}""" // the author of the comment will be the logged in user def author = ComponentAccessor.jiraAuthenticationContext.loggedInUser ComponentAccessor.commentManager.create(issue, author, commentBody, dispatchEvent)
脚本的示例可以参照: