Skip to content

Instantly share code, notes, and snippets.

@cfjedimaster
Created March 12, 2025 15:19
Show Gist options
  • Save cfjedimaster/f83b3eb42d5e3a268a7edc7646ef086f to your computer and use it in GitHub Desktop.
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.
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