Skip to content

Comments

Support co-authors in GitHub flows with Copilot AI as main author and actual contributor as co-author#4746

Merged
lukaszgryglicki merged 18 commits intomainfrom
dev
Aug 8, 2025
Merged

Support co-authors in GitHub flows with Copilot AI as main author and actual contributor as co-author#4746
lukaszgryglicki merged 18 commits intomainfrom
dev

Conversation

@lukaszgryglicki
Copy link
Member

We handle co-authors by searching (case insensitive) for co-authored-by: name <email> git commit trailers.

When handling (name, email) pairs we resolve potential GitHub users as follows:

  1. Match by ID + Login:
  • If the email matches the pattern id+login@users.noreply.github.com, extract the numeric GitHub ID and look up the user by ID.
  1. Match by Login:
  • If the email matches login@users.noreply.github.com, extract the login and look up the user by GitHub username.
  1. Lookup by Email:
  • Otherwise, attempt to find the user using the email address via the GitHub API.
  1. Fallback to Name as Login:

If all else fails, attempt to look up the user treating the provided name as a possible GitHub login (from Co-authored-by: name <email> - we assume that name is login - this is true for AI bots checked so far).

This sequence ensures the most reliable identification of GitHub co-authors from commit metadata.

Internally we cache GitHub users found (or not found which is the most time consuming operation) with TTL = 24 hours and using (name, email) from co-authored-by trailer as a key.

This is implemented in both python and golang backends.

cc @mlehotskylf @jarias-lfx @ahmedomosanya

… actual contributor as co-author

Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
…me, email and caching

Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
… email and caching

Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
…me, email and caching

Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
…or-github-case

Support co-authors in GitHub flows with Copilot AI as main author and actual contributor as co-author
@lukaszgryglicki lukaszgryglicki self-assigned this Aug 7, 2025
Copilot AI review requested due to automatic review settings August 7, 2025 09:39

This comment was marked as outdated.

ahmedomosanya
ahmedomosanya previously approved these changes Aug 7, 2025
…-wide on github-org level

Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
…support-conditional

Make co-authors support configurable per repo, or repo pattern or org-wide on github-org level
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements co-authors support in GitHub flows, allowing CLA systems to handle commits where Copilot AI is the main author and actual contributors are listed as co-authors. The system parses co-authored-by: commit trailers and attempts to resolve GitHub users through multiple lookup strategies.

Key changes:

  • Added database schema and configuration support for enabling co-authors per repository
  • Implemented comprehensive GitHub user lookup logic with caching for co-authors
  • Enhanced commit processing to include co-author analysis when enabled

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
utils/skip_cla_entry.sh Updated example patterns for Copilot-related entries
utils/enable_co_authors_entry.sh New utility script for managing co-authors configuration
utils/copy_prod_case_4.sh New script for copying production data for testing
cla-backend/cla/utils.py Enhanced co-authors extraction with case-insensitive regex
cla-backend/cla/tests/unit/test_github_models.py Added cache clearing and mock updates for co-authors tests
cla-backend/cla/models/github_models.py Core implementation of co-authors support with caching and GitHub user lookup
cla-backend/cla/models/dynamo_models.py Added enable_co_authors field to GitHub organization model
cla-backend-go/v2/sign/helpers.go Updated Go backend to support co-authors in change requests
cla-backend-go/swagger/common/github-organization.yaml Added API documentation for enableCoAuthors field
cla-backend-go/signatures/service.go Updated signature service to use co-authors support
cla-backend-go/github_organizations/models.go Added EnableCoAuthors field to Go organization model
cla-backend-go/github/github_repository.go Implemented comprehensive co-authors processing in Go
cla-backend-go/github/bots.go Added repository pattern matching for co-authors enablement
README.md Added reference to co-authors documentation
CO_AUTHORS.md Comprehensive documentation for co-authors feature

Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>
Copy link
Collaborator

@mlehotskylf mlehotskylf left a comment

Choose a reason for hiding this comment

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

This looks good, my only concerns is that with this approach some co-authors can be identified and some may not, introducing inconsistency. To fix this I suggest:

  1. If maintainers will ask us to enable "co-author feature" for the repo/org then ALL co-authors need to be identified AND be authorized, otherwise entire PR will not pass EasyCLA check. This means co-author trailer always need to have expected format with identifiable co-authors.
  2. If maintainers don't enable co-author feature (default), then EasyCLA will keep current behavior (ignore co-authors)

@lukaszgryglicki
Copy link
Member Author

@mlehotskylf :
1 - this is exactly the case.
2- this is exactly the case.

@mlehotskylf
Copy link
Collaborator

Great, thank you for confirmation. Please add this to the documentation.

@lukaszgryglicki
Copy link
Member Author

@lukaszgryglicki lukaszgryglicki merged commit 3d38e64 into main Aug 8, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants