Skip to content

Commit 99353b3

Browse files
author
Adam Haglund
authored
Add doNotThank option
1 parent 3cef25a commit 99353b3

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

packages/changelog-github/src/index.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,23 @@ const changelogFunctions: ChangelogFunctions = {
4040

4141
return [changesetLink, ...updatedDepenenciesList].join("\n");
4242
},
43-
getReleaseLine: async (changeset, type, options) => {
44-
if (!options || !options.repo) {
43+
getReleaseLine: async (changeset, type, options = {}) => {
44+
if (!options.repo) {
4545
throw new Error(
4646
'Please provide a repo to this changelog generator like this:\n"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]'
4747
);
4848
}
49+
50+
const shouldThank = (user: string) => {
51+
// Handle an array of names to not thank
52+
if (Array.isArray(options.doNotThank)) {
53+
return options.doNotThank.includes(user)
54+
}
55+
56+
// Should thank if it's null, true, anything except false
57+
return options.doNotThank !== false
58+
}
59+
4960
const [firstLine, ...futureLines] = changeset.summary
5061
.split("\n")
5162
.map(l => l.trimRight());
@@ -56,9 +67,9 @@ const changelogFunctions: ChangelogFunctions = {
5667
commit: changeset.commit
5768
});
5869
return `\n\n- ${links.commit}${
59-
links.pull === null ? "" : ` ${links.pull}`
70+
links.pull == null ? "" : ` ${links.pull}`
6071
}${
61-
links.user === null ? "" : ` Thanks ${links.user}!`
72+
links.user == null && shouldThank(links.user) ? "" : ` Thanks ${links.user}!`
6273
} - ${firstLine}\n${futureLines.map(l => ` ${l}`).join("\n")}`;
6374
} else {
6475
return `\n\n- ${firstLine}\n${futureLines.map(l => ` ${l}`).join("\n")}`;

0 commit comments

Comments
 (0)