-
Notifications
You must be signed in to change notification settings - Fork 5k
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
fix: Fix bundle size diffs #29862
fix: Fix bundle size diffs #29862
Conversation
Fix bundle size diffs that are included in `metamaskbot` comments and tracked historically in https://github.com/MetaMask/extension_bundlesize_stats The diffs were incorrect because the "merge base" commit was wrong. The merge base commit is the commit we're comparing the branch against. We were calculating this using `git merge-base origin/main HEAD`, which locally does give the correct answer. But in GitHub Actions, HEAD was not set to the tip of the branch. Instead it was a new comment generated during the checkout step, representing the target branch merged into the current branch. This resulted in the "merge base" always being the tip of `main` (at the time of this workflow run). This in turn resulted in the "bundle diff" including changes that were already made on `main` Fixes #29858.
f6933c7
to
76abec7
Compare
@@ -22,9 +22,10 @@ jobs: | |||
- name: Get merge base commit hash | |||
id: get-merge-base | |||
env: | |||
BASE_REF: ${{ github.event.pull_request.base.ref }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched from ref
to sha
so that this is less dependent upon the branch having been fetched in the checkout step.
Currently it is fetched, as the checkout action will fetch all branches when you specify a fetch-depth of 0. But I wanted this to be resilient to that changing in the future.
Builds ready [76abec7]
Page Load Metrics (1776 ± 147 ms)
Bundle size diffs
|
Description
Fix bundle size diffs that are included in
metamaskbot
comments.The diffs were incorrect because the "merge base" commit was wrong. The merge base commit is the commit we're comparing the branch against. We were calculating this using
git merge-base origin/main HEAD
, which locally does give the correct answer. But in GitHub Actions, HEAD was not set to the tip of the branch. Instead it was a new commit generated during the checkout step, representing the target branch merged into the current branch.This resulted in the "merge base" always being the tip of
main
(at the time of this workflow run). This in turn resulted in the "bundle diff" including changes that were already made onmain
Related issues
Fixes #29858.
Manual testing steps
I created a second draft PR to add diagnostic logs for testing this: #29859
You can see an example of these logs here: https://github.com/MetaMask/metamask-extension/actions/runs/12917863547/job/36025202434?pr=29859
Note that the
HEAD
resolves to a totally different commit than the real head of the branch (which is accessible aspull_request.head.sha
), resulting in a different merge base.Screenshots/Recordings
N/A
Pre-merge author checklist
Pre-merge reviewer checklist