Generating a task list from JIRA issues using XML-RPC and Groovy
This is just a quick note demonstrating how to generate a task list from issues entered into
JIRA. I use
TaskPaper for creating GTD-style task lists for work and thought it might be handy to tack issues assigned to me in our JIRA issue tracker in the same way. To do so do the following:
- Install Groovy
- Download the Groovy XML-RPC module and copy it to $HOME/.groovy/lib
- Create a filter in JIRA to return tasks that you're interested in. Make note of the filterIdfor the filter you created.
- Create a shell script, here I'll call it jiratasks.groovy, and copy the following code into it:
#!/usr/bin/env groovy
import groovy.net.xmlrpc.XMLRPCServerProxy
import java.text.SimpleDateFormat
// Included to make pretty dates
def dateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
def dateFormat2 = new SimpleDateFormat("yyyy-MM-dd")
// Connect to your server
//Your URL may vary
def server = new XMLRPCServerProxy("https://your.jira.server.net/rpc/xmlrpc")
def jira = server.jira1
// Subsitute your username and password here
def token = jira.login("your_username", "your_password")
// Replace "10021" with your filterId
def issues = jira.getIssuesFromFilter(token, "10021")
// Sort by priority
issues.sort { it.priority }
// Get a list of projects
def projects = issues.collect { it["project"]}
projects.unique().sort()
println "JIRA Issues:"
projects.each { project ->
println("\t${project}:")
issues.each { issue ->
if (issue["project"] == project) {
def creationDate = dateFormat2.format(dateFormat1.parse(issue.created))
println("\t- ${issue.key}: ${issue.summary} @created(${creationDate})")
}
}
}
jira.logout(token)
- Run it like: jiratasks.groovy > JIRATasks.taskpaper
- Voila. A GTD style tasks list that works with TaskPaper
0 comments:
Post a Comment