Repository navigation
ci(bundle-size): read prerendered content at the checked-out commit - #95
Conversation
|
Note The title starts with
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 25 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
commit: |
Bundle sizeClient 867.5 kB No route loads 100 B more or less before it renders. No prerendered URL's initial load or HTML changes by 100 B or more. Brotli sizes. Changes under 100 B are left out of the tables. Measured by nuxt-bundle-analyzer for |
Since #94 added
--urls=/,/page,/getting-started/introduction, the bundle-size job prerenders pages, and every page 404s in CI. On #94,analyze (base)failed with[404] Landing page not found/[404] Page not foundandExiting due to prerender errors., andanalyze (pr)was cancelled. Every PR onmainwould now hit the same failure.The cause is the branch the layer reads content from.
getGitBranch()andtargetBranch()fall back toGITHUB_REF_NAME, which is<number>/mergeonpull_requestruns, so prerendering asks GitHub for a ref that doesn't exist:What changed
bundle-size.ymlsetsVERCEL_GIT_COMMIT_REF, which the layer checks first, to the commit each side checked out:base.shaforbase, andgithub.sha(the PR merge commit, which also exists for fork PRs) forpr.Evidence
Run locally with the same command as CI (
npx nuxt-bundle-analyzer@0.2.0 playground --urls "/,/page,/getting-started/introduction" --no-serve), withGITHUB_TOKENandGITHUB_REF_NAME=94/mergeas on CI:VERCEL_GIT_COMMIT_REF(currentmain)Nothing found at …/git/trees/94%2Fmerge…,[404] Landing page not found,[404] Page not found, prerender fails, same as #94's CIVERCEL_GIT_COMMIT_REF=<commit sha>(this PR)Recorded 3 prerendered pages.,exit=0This PR's own
analyze (base)andanalyze (pr)jobs are the real check: onpull_requestruns the workflow comes from the merge commit, so both sides get the fix.ELI5
The docs site fetches its pages from GitHub using the branch name. In pull-request CI the "branch name" is a fake one, so it found no pages. We now give it the exact commit instead.