Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 3, 2025

Pull Request

Proposed Changes

Adds support for recognizing Co-authored-by: commit trailers to include co-authors as contributors. This addresses the request to acknowledge users who contribute via pair programming or collaborative commits.

Changes

  • New env var ACKNOWLEDGE_COAUTHORS (default: True) - enables co-author detection out of the box
  • get_coauthors_from_message() - parses Co-authored-by: trailers from commit messages, supporting any email domain
  • get_coauthor_contributors() - iterates commits to aggregate co-author contributions, builds email-to-username mapping, and merges contributions with existing contributors
  • Modified get_contributors() and get_all_contributors() - integrates co-author detection when enabled, with explicit parameter passing (no default values in function signatures)

How it works

The action now scans commit messages by default for Co-authored-by: trailers and intelligently correlates co-author emails to GitHub usernames:

  1. Builds email-to-username mapping: Scans all commits in the repository to map author emails to their GitHub usernames
  2. Smart correlation: When processing co-authors, attempts to match their email to a known GitHub username from the mapping
  3. Merges contributions: If a co-author matches an existing contributor (by username), their co-authored commits are added to that contributor's count instead of creating a duplicate entry
  4. Fallback behavior: If an email can't be matched to a username, it's used as-is

Example commit message:

Feature implementation

Co-authored-by: Alice <alice@users.noreply.github.com>
Co-authored-by: Bob <bob@example.com>

Key benefits:

  • No duplicate rows for the same person (e.g., someone with 5 authored and 3 co-authored commits shows as one entry with 8 total)
  • Accurate contributor counts since co-author and author contributions are combined
  • Working commit history links since co-authors are properly linked to their GitHub usernames

This feature is enabled by default to provide out-of-the-box support for collaborative workflows.

The acknowledge_coauthors parameter is always explicitly passed from the environment configuration to avoid confusion about default precedence.

Usage

The feature is enabled by default. To disable it:

- name: Run contributor action
  uses: github/contributors@v1
  env:
    GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    ACKNOWLEDGE_COAUTHORS: "false"

Readiness Checklist

Author/Contributor

  • If documentation is needed for this change, has that been included in this pull request
  • run make lint and fix any issues that you have introduced
  • run make test and ensure you have test coverage for the lines you are introducing
  • If publishing new data to the public (scorecards, security scan results, code quality results, live dashboards, etc.), please request review from @jeffrey-luszcz

Reviewer

  • Label as either bug, documentation, enhancement, infrastructure, maintenance or breaking
Original prompt

This section details on the original issue you should resolve

<issue_title>Commits might be created by multiple authors. GitHub supports Co-authored-by: for this.</issue_title>
<issue_description>Commits might be created by multiple authors. GitHub supports Co-authored-by: for this.

The action should also report users with Co-authored-by.


Sometimes, one can get the user information by crawling the commits of the PR. I did that in https://github.com/koppor/github-contributors-list. Would be nice if this action supported this as well.

Originally posted by @koppor in #371</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 3, 2025 23:01
Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for commits by multiple authors feat: add support for Co-authored-by commit trailers Dec 3, 2025
Copilot AI requested a review from zkoppert December 3, 2025 23:05
@zkoppert zkoppert added enhancement New feature or request and removed feature labels Dec 8, 2025
@zkoppert
Copy link
Member

zkoppert commented Dec 8, 2025

@copilot instead of having ACKNOWLEDGE_COAUTHORS default to False, lets change it to defaulting to true. I think that users will want that to work out of the box. Make sure to update that in the code and documentation as well.

Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 8, 2025

@copilot instead of having ACKNOWLEDGE_COAUTHORS default to False, lets change it to defaulting to true. I think that users will want that to work out of the box. Make sure to update that in the code ...

Changed default to True in commit 9798816. Updated:

  • env.py: Default parameter changed to True
  • README.md: Default value in table changed to True
  • .env-example: Example value changed to "True"
  • test_env.py: Test assertions updated to expect True

@zkoppert
Copy link
Member

@copilot instead of only allowing specific email domains for coauthors, please change the code and documentation to allow any email domain to be recognized as a coauthor. For example: right now john@example.com is not counted as a coauthor but id like that functionality changed so it is included.

Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 13, 2025

@copilot instead of only allowing specific email domains for coauthors, please change the code and documentation to allow any email domain to be recognized as a coauthor. For example: right now john@e...

Changed in commit 211543e. Now any email domain is recognized as a co-author:

  • GitHub noreply emails (e.g., username@users.noreply.github.com) extract the username
  • Other emails (e.g., john@example.com) use the full email address as the identifier
  • Updated tests and documentation to reflect this change

@zkoppert
Copy link
Member

Testing locally today

@zkoppert
Copy link
Member

Notes from testing:

  • Copilot starts to show up as a contributor but the link to commit history shows up blank because none of the commits are authored by copilot only coauthored.
  • Coauthors show up as email addresses which may present as a duplicate of an existing user in the table. for example if I had 5 commits authored and 3 coauthored commits, then it would show 2 rows in the table, one for each type of authorship. Not ideal.
  • Since coauthor identities are considered separate from author identities, numbers reflecting the number of new contributors or total contributors are inaccurate.

@zkoppert
Copy link
Member

@copilot Can you figure out how to make sure that the email specified as the co-author is correlated with its github username and added to the stats in the table for that user?

…g contributors

Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 30, 2025

@copilot Can you figure out how to make sure that the email specified as the co-author is correlated with its github username and added to the stats in the table for that user?

Implemented in commit ee109e5. The solution:

  1. Email to username mapping: Builds a mapping from email addresses to GitHub usernames by scanning commit author data
  2. Smart correlation: When processing co-authors, attempts to match their email to a known GitHub username from the mapping
  3. Merge instead of duplicate: If a co-author matches an existing contributor, their co-authored commits are added to that contributor's count instead of creating a separate entry
  4. Fallback behavior: If an email can't be matched to a username, it's used as-is (mainly for external contributors)

This addresses all three issues from testing:

  • Co-authors with matching GitHub accounts are properly merged with their regular contributions
  • No duplicate rows in the table for the same person
  • Accurate contributor counts since co-author and author contributions are combined

Copilot AI changed the title feat: add support for Co-authored-by commit trailers feat: add support for Co-authored-by commit trailers with username correlation Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature release

Projects

None yet

2 participants