Internal: Retain commit authors for split monorepo packages #2067
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Key changes made:
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).