Skip to content

Instantly share code, notes, and snippets.

@afternoon
Created May 19, 2014 16:15
Show Gist options
  • Save afternoon/6012b8ba1292810b40ad to your computer and use it in GitHub Desktop.
Save afternoon/6012b8ba1292810b40ad to your computer and use it in GitHub Desktop.
Show a report of progress on Jira epics from a rapid board
#!/usr/bin/env node
var request = require('request-promise'),
Table = require('cli-table');
var jiraUrl = 'http://jira.yourcompany.com', // change this
rapidViewId = 1, // get this from the rapid board URL
url = jiraUrl + '/rest/greenhopper/1.0/xboard/plan/backlog/epics?rapidViewId=' + rapidViewId,
interestingEpics = []; // add epic IDs to restrict what's included
var progressBar = function (percentageCompleted) {
var numBars = Math.floor((percentageCompleted || 0) / 10),
numSpaces = 10 - numBars;
return '[' + Array(numBars + 1).join('=') + Array(numSpaces + 1).join(' ') + ']';
};
request({url: url, json: true}).then(function (data) {
var table = new Table({head: ['Epic', 'Summary', 'Complete', '']});
data.epics.filter(function (epic) {
return interestingEpics.length === 0 ||
interestingEpics.indexOf(epic.id) !== -1;
}).forEach(function (epic) {
table.push([
epic.id,
epic.summary,
epic.epicStats.percentageCompleted + '%',
progressBar(epic.epicStats.percentageCompleted)
]);
});
console.log(table.toString());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment