Add GitHub Checks output mode for bundle analysis#98
Open
mohsen1 wants to merge 5 commits intohashicorp:mainfrom
Open
Add GitHub Checks output mode for bundle analysis#98mohsen1 wants to merge 5 commits intohashicorp:mainfrom
mohsen1 wants to merge 5 commits intohashicorp:mainfrom
Conversation
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This adds a new
outputModefor bundle analysis publishing:comment: keep the existing PR comment behaviorcheck: publish the full report to a real GitHub Check Run and only post a short PR comment when increases exceed thresholdsboth: publish the full report to both the Check Run and the PR conversationIt also adds threshold-aware managed comment behavior, workflow input overrides, neutral handling for missing base artifacts, and support for
buildOutputDirectoryresolution frompackage.json.Key changes
commentmodecheckmode when thresholds are exceededbothmode comments in placepackage.jsoncompare.jsandreport.jsfor better testability/_app, and mode-specific behaviorValidation
Local:
npm testLive end-to-end validation in a public Next.js repo:
checkmode regression, then thresholds raised so the managed comment was removed while the custom check remained: Validate bundle increase reporting mohsen1/nextjs-bundle-analysis-e2e#1checkmode docs-only PR with1 Bthresholds showed the expected noise from tiny global drift, which is why practical thresholds matter: Validate no-bundle-change behavior mohsen1/nextjs-bundle-analysis-e2e#2bothmode regression with a follow-up push updated the existing managed comment in place: Validate both mode comment updates mohsen1/nextjs-bundle-analysis-e2e#3buildOutputDirectoryfrompackage.json(dist) without workflow input override: Validate custom dist output resolution mohsen1/nextjs-bundle-analysis-e2e#4checkmode with practical thresholds (1024bytes) producedNo bundle changeschecks and no managed PR comments across multiple pushes: Validate docs-only behavior with practical thresholds mohsen1/nextjs-bundle-analysis-e2e#5checkmode large regression produced the full report in Checks and a short threshold comment in the PR: Validate check-mode regression comment mohsen1/nextjs-bundle-analysis-e2e#6commentmode regression produced only the PR comment and no custom Check Run: Validate comment mode regression mohsen1/nextjs-bundle-analysis-e2e#7bothmode docs-only PR with practical thresholds produced a custom check and no PR comment: Validate quiet both-mode behavior mohsen1/nextjs-bundle-analysis-e2e#8commentmode docs-only PR with practical thresholds andskipCommentIfEmptyproduced no PR comment: Validate quiet comment-mode behavior mohsen1/nextjs-bundle-analysis-e2e#9Base bundle artifact missingand no PR comment: Validate missing-base neutral check mohsen1/nextjs-bundle-analysis-e2e#10Notes
Very small thresholds such as
1byte are noisy in practice on real Next.js builds. With practical thresholds like1024, the expected quiet-PR path behaved cleanly in repeated docs-only runs: developers saw the Check Run and did not see a managed PR comment unless there was a meaningful regression.