From d2ca55f9ef15a21cec50fa85ce9d96b487be4242 Mon Sep 17 00:00:00 2001 From: Anbraten Date: Wed, 12 Jul 2023 18:15:02 +0200 Subject: [PATCH] improve contributors listing --- src/cmd/release.ts | 10 ++---- src/utils/__snapshots__/change.test.ts.snap | 34 +++++++++++++-------- src/utils/change.ts | 7 ++++- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/cmd/release.ts b/src/cmd/release.ts index 3e86dd5..c16a335 100644 --- a/src/cmd/release.ts +++ b/src/cmd/release.ts @@ -32,13 +32,9 @@ export async function release({ forge ); - const contributors = `# :heart: Thanks to all the people who contributed! :heart:\n\n${changes - .map((change) => `@${change.author}`) - .join(", ")}`; - const releaseDescription = config.user.getReleaseDescription ? await config.user.getReleaseDescription(hookCtx) - : `${contributors}\n\n${newChangelogSection}`; + : newChangelogSection; console.log("# Creating release"); const releaseLink = await forge.createRelease({ @@ -57,11 +53,11 @@ export async function release({ continue; } - const comment = `:tada: This PR is included in version ${nextVersion} :tada: + const comment = `🎉 This PR is included in version ${nextVersion} 🎉 The release is now available [here](${releaseLink}) -Thank you for your contribution. :heart::package::rocket:`; +Thank you for your contribution. ❤️📦🚀`; await forge.addCommentToPullRequest({ owner: config.ci.repoOwner, diff --git a/src/utils/__snapshots__/change.test.ts.snap b/src/utils/__snapshots__/change.test.ts.snap index 270d096..5dabd88 100644 --- a/src/utils/__snapshots__/change.test.ts.snap +++ b/src/utils/__snapshots__/change.test.ts.snap @@ -3,6 +3,10 @@ exports[`change > should generate a changelog 1`] = ` "## [1.0.0](https://github.com/woodpecker-ci/woodpecker/releases/tag/1.0.0) - 2000-02-01 +### ❤️ Thanks to all contributors! ❤️ + +@John Doe, @Alice Wonderland + ### 💥 Breaking changes - Break everything [[#1339](https://github.com/woodpecker-ci/woodpecker/pull/1339)] @@ -28,20 +32,11 @@ exports[`change > should generate a changelog 1`] = ` exports[`change > should update changelog section 1`] = ` "# Changelog -## [0.0.1](https://github.com/woodpecker-ci/woodpecker/releases/tag/0.0.1) - 2020-01-01 - -### ✨ Features - -- Add new feature (#1338) @Alice Wonderland - -## [0.0.2](https://github.com/woodpecker-ci/woodpecker/releases/tag/0.0.1) - 2020-01-01 +## [1.0.0](https://github.com/woodpecker-ci/woodpecker/releases/tag/1.0.0) - 2000-02-01 -### 🐛 Bug Fixes +### ❤️ Thanks to all contributors! ❤️ -- Fix random UI bug [#1337](https://github.com/woodpecker-ci/woodpecker/pull/1337) ([123](https://github.com/woodpecker-ci/woodpecker/commit/123)) -- Fix another bug [#43](https://github.com/woodpecker-ci/woodpecker/pull/43) ([456](https://github.com/woodpecker-ci/woodpecker/commit/456)) - -## [1.0.0](https://github.com/woodpecker-ci/woodpecker/releases/tag/1.0.0) - 2000-02-01 +@John Doe, @Alice Wonderland ### 💥 Breaking changes @@ -62,5 +57,18 @@ exports[`change > should update changelog section 1`] = ` ### Misc -- Update README ([def](https://github.com/woodpecker-ci/woodpecker/commit/def))" +- Update README ([def](https://github.com/woodpecker-ci/woodpecker/commit/def)) + +## [0.0.2](https://github.com/woodpecker-ci/woodpecker/releases/tag/0.0.1) - 2020-01-01 + +### 🐛 Bug Fixes + +- Fix random UI bug [#1337](https://github.com/woodpecker-ci/woodpecker/pull/1337) ([123](https://github.com/woodpecker-ci/woodpecker/commit/123)) +- Fix another bug [#43](https://github.com/woodpecker-ci/woodpecker/pull/43) ([456](https://github.com/woodpecker-ci/woodpecker/commit/456)) + +## [0.0.1](https://github.com/woodpecker-ci/woodpecker/releases/tag/0.0.1) - 2020-01-01 + +### ✨ Features + +- Add new feature (#1338) @Alice Wonderland" `; diff --git a/src/utils/change.ts b/src/utils/change.ts index beb5beb..544aa4e 100644 --- a/src/utils/change.ts +++ b/src/utils/change.ts @@ -101,9 +101,14 @@ export function getChangeLogSection( nextVersion ); + const contributors = `### ❤️ Thanks to all contributors! ❤️\n\n${changes + .map((change) => `@${change.author}`) + .filter((v, i, a) => a.indexOf(v) === i) + .join(", ")}`; + return `## [${nextVersion}](${releaseLink}) - ${ new Date().toISOString().split("T")[0] - }\n\n${changeLog}`; + }\n\n${contributors}\n\n${changeLog}`; } export function updateChangelogSection(