Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added disableThanks option #1255

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tasty-cameras-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/changelog-github": minor
---

Added `disableThanks` option
2 changes: 2 additions & 0 deletions docs/config-file-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ You would specify our github changelog generator with:
}
```

If you want to disable thank you messages, add `"disableThanks": true` to options.

For more details on these functions and information on how to write your own see [changelog-functions](./modifying-changelog-format.md)

## `bumpVersionsWithWorkspaceProtocolOnly` (boolean)
Expand Down
20 changes: 18 additions & 2 deletions packages/changelog-github/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ jest.mock(
}
);

const getChangeset = (content: string, commit: string | undefined) => {
const getChangeset = (
content: string,
commit: string | undefined,
extraOpts?: { disableThanks?: boolean }
) => {
return [
{
...parse(
Expand All @@ -57,7 +61,7 @@ const getChangeset = (content: string, commit: string | undefined) => {
commit,
},
"minor",
{ repo: data.repo },
{ repo: data.repo, ...extraOpts },
] as const;
};

Expand Down Expand Up @@ -133,3 +137,15 @@ it("with multiple authors", async () => {
"
`);
});

it("disables thanks if disableThanks is enabled", async () => {
expect(
await getReleaseLine(
...getChangeset("", data.commit, {
disableThanks: true,
})
)
).toEqual(
`\n\n- [#1613](https://github.com/emotion-js/emotion/pull/1613) [\`a085003\`](https://github.com/emotion-js/emotion/commit/a085003) - something\n`
);
});
16 changes: 12 additions & 4 deletions packages/changelog-github/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,22 @@ const changelogFunctions: ChangelogFunctions = {
};
})();

const users = usersFromSummary.length
? usersFromSummary
const users = (() => {
if (options.disableThanks) {
return null;
}

if (usersFromSummary.length) {
return usersFromSummary
.map(
(userFromSummary) =>
`[@${userFromSummary}](https://github.com/${userFromSummary})`
)
.join(", ")
: links.user;
.join(", ");
}

return links.user;
})();

const prefix = [
links.pull === null ? "" : ` ${links.pull}`,
Expand Down