Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update changelog #6221

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 41 additions & 3 deletions scripts/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,64 @@ async function run() {

let sortedCommits = [...commits.values()].sort((a, b) => a[1] < b[1] ? -1 : 1);

let categories = {
'enhancements': ['Enhancements'],
'fixes': ['Fixes'],
'docs': ['Docs'],
'construction': ['Under Construction'],
'other': ['Other']
};

for (let commit of sortedCommits) {

let message = '';
let user = '';
let pr;

//look for commits with pr #
// look for commits with pr #
let m = commit[3].match(/(.*?) \(#(\d+)\)$/);

if (m) {
let prId = m[2];
message = m[1];

let res = await octokit.request('GET /repos/adobe/react-spectrum/pulls/{pull}', { pull: prId });
let res = await octokit.request('GET /repos/adobe/react-spectrum/pulls/{pull}', {pull: prId});
user = `[@${res.data.user.login}](${res.data.user.html_url})`;
pr = `https://github.com/adobe/react-spectrum/pull/${prId}`;

} else { // not a pr so just print what we know from the commit
message = commit[3];
user = commit[2];
}
console.log(`* ${message} - ${user}` + (pr ? ` - [PR](${pr})` : ''));

let commitInfo = `* ${message} - ${user}` + (pr ? ` - [PR](${pr})` : '');

if ((/(pre-release)/i).test(message)) {
categories.construction.push(commitInfo);
} else if ((/docs?|documents?|examples?|descriptions?/i).test(message)) {
categories.docs.push(commitInfo);
} else if ((/fix(es)?|remove|bump|update/i).test(message)) {
categories.fixes.push(commitInfo);
} else if ((/adds?|support|feat(ure)?/i).test(message)) {
categories.enhancements.push(commitInfo);
} else {
categories.other.push(commitInfo);
}
}

for (let enhancement of categories.enhancements) {
console.log(enhancement);
}

for (let fix of categories.fixes) {
console.log(fix);
}

for (let doc of categories.docs) {
console.log(doc);
}

for (let other of categories.other) {
console.log(other);
}
}