Skip to content

Commit

Permalink
Add username links in CHANGELOG.md (#4204)
Browse files Browse the repository at this point in the history
Co-authored-by: Zihua Li <635902+luin@users.noreply.github.com>
  • Loading branch information
luin and luin committed May 13, 2024
1 parent e3a6faa commit 9f4e185
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

## What's Changed
### Bug Fixes 🛠
* Fix typing errors for Quill.register by @hzgotb in https://github.com/quilljs/quill/pull/4127
* Fix event source when deleting a link with shortcuts by @luin in https://github.com/quilljs/quill/pull/4200
* Avoid side effects for Enter/Backspace when composing in Safari by @luin in https://github.com/quilljs/quill/pull/4201
* Ignore pasting images when image format is disallowed by @luin in https://github.com/quilljs/quill/pull/4202
* Fix typing errors for Quill.register by [@hzgotb](https://github.com/hzgotb) in https://github.com/quilljs/quill/pull/4127
* Fix event source when deleting a link with shortcuts by [@luin](https://github.com/luin) in https://github.com/quilljs/quill/pull/4200
* Avoid side effects for Enter/Backspace when composing in Safari by [@luin](https://github.com/luin) in https://github.com/quilljs/quill/pull/4201
* Ignore pasting images when image format is disallowed by [@luin](https://github.com/luin) in https://github.com/quilljs/quill/pull/4202

[All changes](https://github.com/quilljs/quill/releases/tag/v2.0.2)

Expand Down
11 changes: 8 additions & 3 deletions scripts/changelog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (currentChangeLog.includes(`# ${release.tagName}`)) {

await configGit();

const filteredReleaseNote = (note) => {
const normalizeReleaseNote = (note) => {
const ignoreSections = [
"## new contributors",
"## all changes",
Expand All @@ -41,7 +41,12 @@ const filteredReleaseNote = (note) => {
note = note.slice(0, index).replace(/#\s*$/, "");
}
});
return note.trim();

return note
.replace(/by @([-\w]+)/g, (_, username) => {
return `by [@${username}](https://github.com/${username})`;
})
.trim();
};

const formatDate = (date) => {
Expand All @@ -53,7 +58,7 @@ const { body } = JSON.parse(
(await $`gh release view ${release.tagName} --json=body`).stdout
);

const note = `# ${release.tagName} (${formatDate(new Date(release.publishedAt))})\n\n${filteredReleaseNote(body)}\n\n[All changes](https://github.com/quilljs/quill/releases/tag/${release.tagName})\n`;
const note = `# ${release.tagName} (${formatDate(new Date(release.publishedAt))})\n\n${normalizeReleaseNote(body)}\n\n[All changes](https://github.com/quilljs/quill/releases/tag/${release.tagName})\n`;

await writeFile(changeLogFilePath, `${note}\n${currentChangeLog}`);

Expand Down

0 comments on commit 9f4e185

Please sign in to comment.