Skip to content

Commit

Permalink
feat(release): allow disabling GitHub username matching in default ch…
Browse files Browse the repository at this point in the history
…angelog renderer (#26672)
  • Loading branch information
JamesHenry authored Jun 25, 2024
1 parent b42b6f7 commit 3a2e8d4
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 2 deletions.
10 changes: 9 additions & 1 deletion docs/shared/recipes/nx-release/configure-changelog-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The default changelog renderer for `nx release` generates a changelog entry for

## Include All Metadata

There are a few options available to modify the default changelog renderer output. They can be applied to both `workspaceChangelog` and `projectChangelogs` in exactly the same way. All three options are true by default:
There are a few options available to modify the default changelog renderer output. They can be applied to both `workspaceChangelog` and `projectChangelogs` in exactly the same way. All four options are true by default:

```json
{
Expand All @@ -27,6 +27,7 @@ There are a few options available to modify the default changelog renderer outpu
"projectChangelogs": {
"renderOptions": {
"authors": true,
"mapAuthorsToGitHubUsernames": true,
"commitReferences": true,
"versionTitleDate": true
}
Expand All @@ -40,6 +41,12 @@ There are a few options available to modify the default changelog renderer outpu

Whether the commit authors should be added to the bottom of the changelog in a "Thank You" section. Defaults to `true`.

#### `mapAuthorsToGitHubUsernames`

If authors is enabled, controls whether or not to try to map the authors to their GitHub usernames using https://ungh.cc (from https://github.com/unjs/ungh) and the email addresses found in the commits. Defaults to `true`.

You should disable this option if you don't want to make any external requests to https://ungh.cc

#### `commitReferences`

Whether the commit references (such as commit and/or PR links) should be included in the changelog. Defaults to `true`.
Expand All @@ -59,6 +66,7 @@ If you prefer a more minimalist changelog, you can set all the options to false,
"projectChangelogs": {
"renderOptions": {
"authors": false,
"mapAuthorsToGitHubUsernames": false,
"commitReferences": false,
"versionTitleDate": false
}
Expand Down
8 changes: 7 additions & 1 deletion packages/nx/release/changelog-renderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ export interface DefaultChangelogRenderOptions extends ChangelogRenderOptions {
* section. Defaults to true.
*/
authors?: boolean;
/**
* If authors is enabled, controls whether or not to try to map the authors to their GitHub usernames
* using https://ungh.cc (from https://github.com/unjs/ungh) and the email addresses found in the commits.
* Defaults to true.
*/
mapAuthorsToGitHubUsernames?: boolean;
/**
* Whether or not the commit references (such as commit and/or PR links) should be included in the changelog.
* Defaults to true.
Expand Down Expand Up @@ -290,7 +296,7 @@ const defaultChangelogRenderer: ChangelogRenderer = async ({
}

// Try to map authors to github usernames
if (repoSlug) {
if (repoSlug && changelogRenderOptions.mapAuthorsToGitHubUsernames) {
await Promise.all(
[..._authors.keys()].map(async (authorName) => {
const meta = _authors.get(authorName);
Expand Down
Loading

0 comments on commit 3a2e8d4

Please sign in to comment.