From 65f2f176958a8673b1dbb4da4fe1d4694f043c4d Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 23 Nov 2022 13:35:57 -0330 Subject: [PATCH] Fix bundle size diff message (#16576) The bundle size diff message is using the wrong point of comparision, leading to misleading results on feature branches that have been merged with `develop` since they were created. When this feature was introduced, we went back and forth a few times on what we should be comparing the branch with to get an accurate bundle size comparison. The first attempt used `develop` as the point of comparison, but that didn't work because it was a moving target, and because it didn't reflect the changes made on this branch. As bundle increases or decreases were added on `develop`, they would alter the diff on each feature PR. Then we chose to use the fork-point of the branch, the commit of `develop` that the branch forked off of. This works for feature branches that don't merge in `develop`. But the minute `develop` gets merged in, then unrelated changes on `develop` affect the measurement. The _most recent_ commit from `develop` on the current branch is a better comparison. Any difference between this commit and the feature branch in terms of bundle size would be attributable to the feature branch changes. This is what `merge-base` gives us. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 40d8bdb90..90b3e2da8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -803,7 +803,7 @@ jobs: - run: name: Set branch parent commit env var command: | - echo "export PARENT_COMMIT=$(git rev-parse "$(git rev-list --topo-order --reverse HEAD ^origin/develop | head -1)"^)" >> $BASH_ENV + echo "export PARENT_COMMIT=$(git merge-base origin/HEAD HEAD)" >> $BASH_ENV source $BASH_ENV - run: name: build:announce