Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal: Retain commit authors for split monorepo packages #2067

Merged
merged 2 commits into from
Dec 21, 2024

Conversation

caendesilva
Copy link
Member

@caendesilva caendesilva commented Dec 21, 2024

Key changes made:

  1. Added new environment variables for author name and email from the head commit
  2. Updated Git config to use the original author's name and email instead of github-actions
  3. Experimental: Makes it so that it says that the original user authored and GitHub Actions committed

This will now attribute the split repository commits to the original author of the commit being synced.


Background

This workflow currently makes the split commit as the GitHub Actions user. This was originally so that if there are multiple commits, we may not want to attribute unrelated commits to authors. But I had an idea:

First, I was thinking that if the commit is a merge commit (like from a pull request), we can use the commit author then. Because if an author merges a PR, they are presumed to be responsible for all commits in that PR, so we can safely attribute the merge to them (as in essence, this split is like a squash merge).

The same if it's just a single commit we are syncing, we can keep the user.

But then, after looking at the commit history, I realized we only ever really have single changes because the merge queue makes so only one change goes through at a time, so the split monorepo job will just run on the last pushed/merged code. So, we can use the author of the last commit.

So, this updates all jobs in the workflow to use the original commit author for the latest commit (the one we're basing the message on).

@caendesilva caendesilva marked this pull request as ready for review December 21, 2024 12:42
@github-actions github-actions bot added the internal This pull request does not affect package code label Dec 21, 2024
Copy link

codecov bot commented Dec 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (b41253e) to head (ddc98b6).
Report is 4 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##              master     #2067   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity      1774      1774           
===========================================
  Files            183       183           
  Lines           4782      4782           
===========================================
  Hits            4782      4782           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@caendesilva caendesilva merged commit 6df11e2 into master Dec 21, 2024
12 checks passed
@caendesilva caendesilva deleted the retain-authors-in-split-monorepo-commits branch December 21, 2024 12:51
@caendesilva
Copy link
Member Author

Yup, looks nice.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal This pull request does not affect package code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant