Created
March 12, 2025 15:19
-
-
Save cfjedimaster/f83b3eb42d5e3a268a7edc7646ef086f to your computer and use it in GitHub Desktop.
Search against a jira instance. Note I used .js for filename to get proper color coding.
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
class { | |
variables.rootUrl = 'root of your jira instal;'; | |
variables.username = 'login'; | |
variables.password = 'my passwords bring all the boys to the yard'; | |
function main(args = []) { | |
if(args.len() < 1) { | |
println('Pass a search term for the open issues you want to find.'); | |
abort; | |
} | |
term = args[1]; | |
jql = 'project=BL and status in ("In Progress", "To do") and summary ~ "#term#"'; | |
jiraURL = '#variables.rootUrl#rest/api/latest/search?jql=#urlEncodedFormat(jql)#&maxResults=1000'; | |
bx:http url=jiraURL result="result" username=variables.username password=variables.password { | |
bx:httpparam type="header" name="Accept" value="application/json"; | |
} | |
issueResult = jsonDeserialize(result.filecontent); | |
println('#issueResult.total# open issue(s) found.#char(10)#'); | |
for(issue in issueResult.issues) { | |
println('Summary: ' & issue.fields.summary); | |
println('Link: ' & variables.rootUrl & 'browse/' & issue.key); | |
println(''); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment