forked from redallen/patternfly-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-breaking-notes.js
More file actions
27 lines (22 loc) · 935 Bytes
/
generate-breaking-notes.js
File metadata and controls
27 lines (22 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const path = require('path');
const fs = require('fs');
function makeReleaseNotes(owner, repo) {
const baseDir = path.resolve('github', owner, repo, 'pull_requests');
const pullRequests = require(path.join(baseDir, 'list.json'));
let notes = '';
pullRequests
.filter(pullRequest => pullRequest.merged_at)
.sort(pullRequest => pullRequest.number)
.forEach(pullRequest => {
const breakingChanges = /# breaking change.*\r?\n([\s\S]*)/igm.exec(pullRequest.body);
if (breakingChanges) {
console.log(pullRequest.number);
notes += `\n## ${pullRequest.title} [(#${pullRequest.number})](${pullRequest.html_url})`;
notes += `\n${breakingChanges[1].replace(/\r\n/g, '\n').trim()}`;
notes += '\n';
}
});
fs.writeFileSync(path.join(baseDir, 'breaking-change-notes.md'), notes.trim());
}
const split = process.argv[2].split('/');
makeReleaseNotes(split[0], split[1]);