Skip to content

fix: credit co-authors of a PR in the generated changelog - #6358

Queued
andygrove wants to merge 1 commit into
apache:mainfrom
andygrove:fix-changelog-author-credit
Queued

andygrove wants to merge 1 commit into
apache:mainfrom
andygrove:fix-changelog-author-credit

Conversation

@andygrove

Copy link
Copy Markdown
Member

Which issue does this PR close?

There is no issue for this. It came up while generating the 1.1.0 changelog in #6282.

Rationale for this change

#6219 carries the commits from #6092 by Michael Taranov (mixermt), but the generated 1.1.0 changelog credits #6219 only to andygrove, and Michael is missing from the credits. The script credits each PR to the author of the commit that merged it, on the PR's line (commit.author.login) and in the credits (git shortlog). When a squash-merged PR has commits from more than one person, GitHub records the others only as Co-authored-by trailers on that commit, and neither of those reads them. The four backports on branch-1.1 (#6266, #6305, #6318 and #6323) have the same problem: they are credited to whoever opened the backport, and not to the author of the original change.

What changes are included in this PR?

For a PR whose merge commit has a Co-authored-by trailer, generate-changelog.py now fetches the PR's commits and credits the GitHub account of each commit's author, on the PR's line and in the credits. It leaves out:

  • Merges of the base branch into the PR. Most of the trailers that name a maintainer come from these (the "Update branch" button), not from commits they wrote.
  • Commits whose email is not linked to a GitHub account. Across the repository's history, every one of these is a second address of the PR's own author, or a machine-local identity such as Hung <hung@Hungs-Mac-mini.local>.
  • Accounts that have never opened an issue or PR in the repository. GitHub links a commit to whichever account has its email address, so the sandbox identity test <a@b.c> in three of the 1.1.0 PRs resolves to an unrelated account, as do a guessed erik@users.noreply.github.com and a Cursor Agent commit. The script prints each account it leaves out this way to stderr, so the release manager can check them.

AI assistants that only appear as a Co-authored-by trailer on a commit are not credited, because only commit authors are.

In the credits, a co-author counts once for each such PR, under the name git shortlog already lists them under, and counts toward the number of contributors in the header. As in git shortlog, a name counts once per PR, so someone who committed from two accounts under the same name is not counted twice. The credits sentence now says that a PR with commits from more than one person counts for each of them.

Only PRs with a trailer need the extra calls: 107 of the 399 commits in the 1.1.0 range, plus one issue lookup per co-author account. The issue lookup reads the first page rather than totalCount, which PyGithub reports as 0 for this endpoint because GitHub pages it with a cursor.

How are these changes tested?

The release scripts have no test harness, so I generated changelogs before and after the change and compared them.

For 1.1.0 (1.0.0..branch-1.1 at 39779e3), the only differences are:

To check the rules beyond one release, I applied them to all 430 PRs on main whose merge commit has a trailer. They credit 14 accounts, each of them someone who wrote commits in the PR. The issue-or-PR check leaves out 6: the three above, and three second accounts of the PR's own author. Generating 0.6.0 covers the two-account case: #1392 is credited to EmilyMatt, EmilyFlarionIO, and Emily Matheys still counts once for it.

generate-changelog.py credited each PR only to the author of the commit
that merged it, both on the PR's line and in the credits, so anyone else
whose commits were squashed into the PR went uncredited. apache#6219 carries
the commits from apache#6092, and the 1.1.0 changelog left their author out.

For a merge commit with a Co-authored-by trailer, the script now fetches
the PR's commits and credits the GitHub account of each commit's author.
It skips merges of the base branch, commits whose email is not linked to
an account, and accounts that have never opened an issue or PR in the
repository. GitHub links a commit to whichever account has its email
address, so a placeholder identity or an AI agent's commits can
otherwise be credited to an unrelated account. The script prints each
account it skips for that reason.

In the credits, a co-author counts once for each such PR, under the name
git shortlog already lists them under, and counts toward the number of
contributors in the header. As in git shortlog, a name counts once per
PR, so someone who committed from two accounts is not counted twice.
@github-actions github-actions Bot added bug Something isn't working area:ci CI/CD, GitHub Actions, build tooling labels Sep 28, 2026
andygrove added a commit that referenced this pull request Sep 28, 2026
Regenerate the 1.1.0 changelog with the generator from #6358, for the
same range as #6282 (1.0.0..021c378), and format it with prettier
3.9.9. The generator used for #6282 credited each PR only to the author
of its merge commit, so it left out Michael Taranov, whose commits from
#6092 are in #6219, and credited the backports only to the person who
opened them.

The PR lines for #5310, #6219, #6223 and the four backports now name
their co-authors, and the credits count each co-authored PR, which adds
Michael Taranov and brings the contributor count to 41.

@sunchao sunchao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

  • Prior state and problem: Changelogs credited squash-merge authors while omitting contributors whose commits were included in those PRs.
  • Design approach: pull_authors collects commit authors for PRs with co-author trailers. A Counter incorporates their contributions into release credits.
  • Correctness / compatibility analysis: Live base/head comparisons verified attribution for #6219 and #6223. Additional API checks verified backport #6266 and two-account attribution in #1392. Spark semantics and supported-version behavior are unaffected by this release-tooling change.
  • Key design decisions: Merge commits and unlinked identities are excluded. Additional accounts must have opened an issue or PR. Trailer-gated requests and cached participation lookups bound the added API work.
  • Implementation sketch: The localized helper supplies author mappings to existing categorization and formatting. Credits reuse known names and deduplicate names per PR.
  • Behavioral changes worth calling out: PR entries list multiple accounts, co-authors increase credit totals, and rejected accounts are reported to stderr.
  • Suggested improvements: None meeting the P1/P2 reporting threshold. No introduced P1/P2 issues found within this review.

Reviewed the entire diff from e1d2c11729c2fc60a5def4e87bb17e5b28df2a29 to dfe0c8a2070e927d89d4ea22349fb5e08fbc5528. The PR is not a draft. Read AGENTS.md and applied review-comet-pr; no sibling skill applies. The snapshot and live GitHub checks contained no existing reviews, comments, or threads.

Exact-head CI: 7 checks passed, 15 jobs skipped, no failures. Builds and Spark/Iceberg suites were skipped.

Validation: Six disposable tests passed, alongside the live checks above, using PyGithub 2.10.0. Full-release changelog regeneration and JVM/native builds were not run. Project source remains unchanged.

@andygrove
andygrove added this pull request to the merge queue Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI/CD, GitHub Actions, build tooling bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants