diff options
author | Luke Karrys <luke@lukekarrys.com> | 2022-04-06 19:27:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-06 19:27:26 +0300 |
commit | e034a8efe76d12149a05b18798ad0fc599ecd2e1 (patch) | |
tree | 879fcf90b7e2b8b35b07a0f6e3b7e40259b0c7c6 /scripts | |
parent | 7712b496ac689c8c46c47dbdc373b72efee5e2c9 (diff) |
chore(changelog): reformat to gh release style user links when reading (#4676)
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/changelog.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/changelog.js b/scripts/changelog.js index 8c88490e8..0c50b562d 100644 --- a/scripts/changelog.js +++ b/scripts/changelog.js @@ -124,7 +124,7 @@ const parseArgs = (argv) => { file: resolve(__dirname, '..', 'CHANGELOG.md'), branch: 'latest', remote: 'origin', - releaseNotes: false, + type: 'md', // or 'gh' write: false, read: false, help: false, @@ -329,7 +329,7 @@ const generateRelease = async (args) => { groupCommit += ` ${commit.title}` if (key !== 'Dependencies') { for (const user of commit.credit) { - if (args.releaseNotes) { + if (args.type === 'gh') { groupCommit += ` (${user.name})` } else { groupCommit += ` ([${user.name}](${user.url}))` @@ -360,7 +360,13 @@ const main = async (argv) => { if (args.read) { // this reads the release notes for that version - return console.log(findRelease(args, args.endTag || args.startTag).release) + let { release } = findRelease(args, args.endTag || args.startTag) + if (args.type === 'gh') { + // changelog was written in markdown so convert user links to gh release style + // XXX: this needs to be changed if the `generateRelease` format changes + release = release.replace(/\(\[(@[a-z\d-]+)\]\(https:\/\/github.com\/[a-z\d-]+\)\)/g, '($1)') + } + return console.log(release) } // otherwise fetch the requested release from github |