Skip to content

Add GitHub Checks output mode for bundle analysis#98

Open
mohsen1 wants to merge 5 commits intohashicorp:mainfrom
mohsen1:feat/check-output-mode
Open

Add GitHub Checks output mode for bundle analysis#98
mohsen1 wants to merge 5 commits intohashicorp:mainfrom
mohsen1:feat/check-output-mode

Conversation

@mohsen1
Copy link
Copy Markdown

@mohsen1 mohsen1 commented Apr 8, 2026

Summary

This adds a new outputMode for bundle analysis publishing:

  • comment: keep the existing PR comment behavior
  • check: publish the full report to a real GitHub Check Run and only post a short PR comment when increases exceed thresholds
  • both: publish the full report to both the Check Run and the PR conversation

It also adds threshold-aware managed comment behavior, workflow input overrides, neutral handling for missing base artifacts, and support for buildOutputDirectory resolution from package.json.

Key changes

  • add real Check Run publishing in the reusable workflow
  • keep default behavior backward-compatible for comment mode
  • only post short regression comments in check mode when thresholds are exceeded
  • delete threshold comments again when the PR goes back under threshold
  • update both mode comments in place
  • support workflow input overrides for output mode and thresholds
  • resolve custom build output directories from workflow input or package.json
  • refactor compare.js and report.js for better testability
  • add coverage for missing artifacts, budget math, zero-size pages, App Router-style builds without /_app, and mode-specific behavior
  • opt JavaScript actions into Node 24 to avoid Node 20 action deprecation warnings

Validation

Local:

  • npm test

Live end-to-end validation in a public Next.js repo:

Notes

Very small thresholds such as 1 byte are noisy in practice on real Next.js builds. With practical thresholds like 1024, 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.

@hashicorp-cla-app
Copy link
Copy Markdown

hashicorp-cla-app bot commented Apr 8, 2026

CLA assistant check
All committers have signed the CLA.

@hashicorp-cla-app
Copy link
Copy Markdown

CLA assistant check

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant