Skip to content

Instantly share code, notes, and snippets.

@PanayotCankov
Created June 11, 2015 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PanayotCankov/219b6a2db9fa814781da to your computer and use it in GitHub Desktop.
Save PanayotCankov/219b6a2db9fa814781da to your computer and use it in GitHub Desktop.
Automatically generate CHANGELOG.md
import https = require('https');
import fs = require('fs');
var options = {
hostname: 'api.github.com',
path: '/repos/NativeScript/ios-runtime/issues?milestone=3&state=closed',
method: 'GET',
headers: {
"User-Agent": "AutoRN"
}
};
var msg = "";
var req = https.request(options, function (res) {
res.on('data', function (d) {
msg += d;
});
res.on('end', function (d) {
var output = fs.createWriteStream("CHANGELOG.md");
var issues = JSON.parse(msg);
var bugs = issues.filter(i => i.labels.filter(l => l.name == "T:Bug").length > 0);
var features = issues.filter(i => i.labels.filter(l => l.name == "T:Feature").length > 0);
var md = "";
printSection("Bug Fixes", bugs);
printSection("Features", features);
function printSection(title, issues) {
if (issues.length > 0) {
md += title + "\r\n";
md += "=========\r\n";
issues.forEach(printIssue);
md += "\r\n";
}
}
function printIssue(i) {
md += "\r\n";
md += "#### [(#" + i.number + ")](" + i.html_url + ") " + i.title + "\r\n";
md += i.body + "\r\n";
}
fs.writeFileSync("CHANGELOG.md", md);
});
});
req.end();
req.on('error', function (e) {
console.error(e);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment