Skip to content

Instantly share code, notes, and snippets.

@firebait
Last active May 30, 2019 21:05
Show Gist options
  • Save firebait/671291d796fe2de5bb3bd7e9d01f2443 to your computer and use it in GitHub Desktop.
Save firebait/671291d796fe2de5bb3bd7e9d01f2443 to your computer and use it in GitHub Desktop.
Gist generates a URL that will find the list of JIRA tickets for a particular release. UPDATE YOUR CREDENTIALS AND RELEASE BRANCH.
const https = require('https');
//////////// UPDATE THESE VALUES /////////////
const releaseBranch = '<RELEASE BRANCH>';
const githubUsername = '<YOUR USERNAME>';
const githubPassword = '<YOUR PASSWORD>'
//////////////////////////////////////////////
const stories = new Set();
let processedRepos = 0;
const repos = [
"alerts-runner",
"bacon",
"delorean",
"pancake",
"pipe",
"realtime",
"scribe",
"zcc-controller",
"zen-mobile",
"zignal-auth",
"zignal-enterprise",
"zignal-proxy",
"zql-translation",
"tag-updater",
"deep-time",
"test_automation",
"mobile_automation",
"platformation",
"recommended-terms"
];
repos.forEach(repo => {
https.get(
{
hostname: 'api.github.com',
path: `/repos/politear/${repo}/compare/master...${releaseBranch}`,
auth: `${githubUsername}:${githubPassword}`,
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Accept': 'application/vnd.github+json',
'User-Agent': 'zignallabs',
}
},
(res) => {
res.setEncoding('utf8');
let rawData = '';
res.on('data', (chunk) => { rawData += chunk; });
res.on('end', () => {
try {
const data = JSON.parse(rawData);
if(data.commits) {
const commits = data.commits;
commits.forEach(commit => {
const message = commit.commit.message;
const story = message.match('ENG-[0-9]*');
if(story) {
stories.add(story[0]);
}
});
}
processedRepos++;
if (processedRepos >= repos.length) {
console.log(`https://politear.atlassian.net/issues/?jql=key%20in%20(%22${Array.from(stories).join('%22%2C%22')}%22)%20and%20status%3DDone%20and%20(labels%20not%20in%20(shipped)%20OR%20labels%20is%20EMPTY)%20ORDER%20BY%20priority%20DESC%2C%20updated%20DESC`);
}
} catch (e) {
console.error(e.message);
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment