Skip to content

Commit dd2b3d1

Browse files
t3dotggclaude
andcommitted
fix(release): a PR author's direct push no longer counts twice
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 3fd9948 commit dd2b3d1

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎scripts/generate-release-notes.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ it("counts each person once and leaves out bots", () => {
2222
{ subject: "fix: direct push by a PR author", authorName: "Ada Lovelace" },
2323
{ subject: "fix: direct push by someone else", authorName: "Grace Hopper" },
2424
{ subject: "chore: direct push by a bot", authorName: "t3-code[bot]" },
25+
{ subject: "fix(web): four (#4)", authorName: "Linus T" },
26+
{ subject: "fix: direct push by a PR author with no profile name", authorName: "Linus T" },
2527
];
2628
const pullRequests = new Map([
2729
[1, pullRequest({ __typename: "User", login: "ada", name: "Ada Lovelace" })],
2830
[2, pullRequest({ __typename: "User", login: "ada", name: "Ada Lovelace" })],
2931
[3, pullRequest({ __typename: "Bot", login: "dependabot" })],
32+
[4, pullRequest({ __typename: "User", login: "linus", name: null })],
3033
]);
3134

32-
assert.equal(countContributors(commits, pullRequests), 2);
35+
assert.equal(countContributors(commits, pullRequests), 3);
3336
});
3437

3538
it("leaves mobile-only scopes out and keeps shared ones", () => {

‎scripts/generate-release-notes.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ export function countContributors(
152152
people.add(author.login);
153153
if (author.name) names.add(author.name);
154154
}
155+
// A PR's squash commit carries its author's git name, which may differ from the profile name.
156+
for (const commit of commits) {
157+
if (pullRequestNumber(commit.subject) !== undefined) names.add(commit.authorName);
158+
}
155159
for (const commit of commits) {
156160
if (
157161
pullRequestNumber(commit.subject) === undefined &&

0 commit comments

Comments
 (0)