Skip to content

Commit

Permalink
improve contributors listing
Browse files Browse the repository at this point in the history
  • Loading branch information
anbraten committed Jul 12, 2023
1 parent 34e975b commit d2ca55f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
10 changes: 3 additions & 7 deletions src/cmd/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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,
Expand Down
34 changes: 21 additions & 13 deletions src/utils/__snapshots__/change.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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
Expand All @@ -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"
`;
7 changes: 6 additions & 1 deletion src/utils/change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit d2ca55f

Please sign in to comment.