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

[core] Reference commits in changelog when no PR #44115

Merged
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion scripts/releaseChangelog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ async function findLatestTaggedVersion() {
return stdout.trim();
}

// Match commit messages like:
// "[docs] Fix small typo on Grid2 page (#44062)"
const prLinkRegEx = /\(#[0-9]+\)$/;

async function main(argv) {
const { githubToken, lastRelease: lastReleaseInput, release, repo } = argv;

Expand Down Expand Up @@ -156,7 +160,13 @@ async function main(argv) {
return aTags.localeCompare(bTags);
});
const changes = commitsItems.map((commitsItem) => {
const shortMessage = commitsItem.commit.message.split('\n')[0];
let shortMessage = commitsItem.commit.message.split('\n')[0];

// If the commit message doesn't have an associated PR, add the commit reference.
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved
if (!prLinkRegEx.test(shortMessage)) {
shortMessage += ` (${commitsItem.sha.substring(0, 7)})`;
}

return `- ${shortMessage} @${getAuthor(commitsItem)}`;
});
const nowFormatted = new Date().toLocaleDateString('en-US', {
Expand Down