Last active
August 1, 2017 20:07
-
-
Save jontutcher/e9a88bdd35f9a1e1934f264aedfd7cea to your computer and use it in GitHub Desktop.
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
// Script to parse the contents of MozFest 2017 Decentralization Issues and turn into TSV of relevant info | |
// Runs in Node.js 8 | |
// cURL command to get JSON (paginated, need to request all pages through page parameter or follow LINK field) | |
// curl -X GET \ | |
// 'https://api.github.com/repos/MozillaFoundation/mozfest-program-2017/issues?milestone=2&page=1' \ | |
// -H 'accept: application/vnd.github.VERSION.text+json' \ | |
// -H 'authorization: token [YOUR OAUTH TOKEN]' \ | |
// -H 'cache-control: no-cache' \ | |
// -H 'milestone: 2' | |
// fullpages.json is the combined results of all pages of that cURL request | |
const fs = require('fs'); | |
let obj = JSON.parse(fs.readFileSync('fullpages.json', 'utf8')); | |
const stipendRequested = (obj) => { | |
let stipend = obj.labels.filter(label => label.id==615615796); | |
if (stipend.length>0) { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
const isInDecentralizationMilestone = (obj) => (obj.milestone.title==='Decentralization'); | |
const printLineForIssue = (singleIssue) => { | |
console.log(`"${singleIssue.number}"\t"${singleIssue.html_url}"\t"${singleIssue.title}"\t"${stipendRequested(singleIssue)}"`); | |
} | |
for (let singleIssue of obj.filter(isInDecentralizationMilestone)) { | |
printLineForIssue(singleIssue); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment