Last active
August 29, 2015 14:16
-
-
Save rahulsom/a7da12c7956ab08fce4b to your computer and use it in GitHub Desktop.
Get Sprint Notes from JIRA
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
alias releaseNotes="groovy https://gist.githubusercontent.com/rahulsom/a7da12c7956ab08fce4b/raw/release-notes.groovy" | |
alias sprintNotes="groovy https://gist.githubusercontent.com/rahulsom/a7da12c7956ab08fce4b/raw/sprint-notes.groovy" |
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
@Grab(group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.7') | |
import groovyx.net.http.* | |
import org.apache.http.HttpRequest | |
import org.apache.http.HttpRequestInterceptor | |
import org.apache.http.protocol.HttpContext | |
import static groovyx.net.http.ContentType.JSON | |
import groovy.json.* | |
if (args.length != 5) { | |
println """ | |
Usage | |
${this.class.simpleName}.groovy <JIRA_URL> <username> <password> <JIRA_PROJECT> <version> | |
Example | |
${this.class.simpleName}.groovy https://myaccount.atlassian.net/ user paasword "My Project Name" 1.0 | |
""" | |
System.exit(1) | |
} | |
assert args.length == 5 | |
def http = new HTTPBuilder(args[0], JSON) | |
http.client.addRequestInterceptor(new HttpRequestInterceptor() { | |
void process(HttpRequest httpRequest, HttpContext httpContext) { | |
httpRequest.addHeader('Authorization', 'Basic ' + "${args[1]}:${args[2]}".bytes.encodeBase64().toString()) | |
} | |
}) | |
def resp = http.get( | |
path: '/rest/api/2/search', | |
query: [ | |
jql : """\ | |
project = "${args[3]}" | |
AND fixVersion = "${args[4]}" | |
AND type in standardIssueTypes() | |
""".stripIndent().replace('\n',''), | |
fields: 'key,summary,issuetype' | |
], | |
) | |
resp.issues. | |
groupBy {it.fields.issuetype.name}.findAll {k,v -> k != 'Test'}. | |
each { k, v -> | |
println k | |
println k.replaceAll(/./,'=') | |
v.each { | |
println "[${it.key}] ${it.fields.summary}" | |
} | |
println "" | |
} |
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
@Grab(group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.7') | |
import groovyx.net.http.* | |
import org.apache.http.HttpRequest | |
import org.apache.http.HttpRequestInterceptor | |
import org.apache.http.protocol.HttpContext | |
import static groovyx.net.http.ContentType.JSON | |
if (args.length != 4) { | |
println """ | |
Usage | |
${this.class.simpleName}.groovy <JIRA_URL> <username> <password> <JIRA_PROJECT> | |
Example | |
${this.class.simpleName}.groovy https://myaccount.atlassian.net/ user paasword "My Project Name" | |
""" | |
System.exit(1) | |
} | |
assert args.length == 4 | |
def http = new HTTPBuilder(args[0], JSON) | |
http.client.addRequestInterceptor(new HttpRequestInterceptor() { | |
void process(HttpRequest httpRequest, HttpContext httpContext) { | |
httpRequest.addHeader('Authorization', 'Basic ' + "${args[1]}:${args[2]}".bytes.encodeBase64().toString()) | |
} | |
}) | |
def resp = http.get( | |
path: '/rest/api/2/search', | |
query: [ | |
jql : """\ | |
project = "${args[3]}" | |
AND Sprint in openSprints() | |
AND type in standardIssueTypes() | |
""".stripIndent().replace('\n',''), | |
fields: 'key,summary' | |
], | |
) | |
resp.issues.each { | |
println "[${it.key}] ${it.fields.summary}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment