We are excited to announce the initial draft release of the NaverPay Size Action, a custom GitHub Action designed to monitor and compare build sizes and dependency changes in pull requests. This action provides developers with detailed insights into how their code changes impact project size.
Key Features
-
Pull Request Analysis
- Automatically triggers on pull requests to compare build and dependency sizes between branches.
-
Build Size Comparison
- Analyze the size impact on Next.js applications with support for gzip and Brotli compression.
-
Dependency Size Analysis
- Detect changes in dependency sizes using
npm view
or Bundlephobia API.
- Detect changes in dependency sizes using
-
Customizable Reports
- Options to:
- Show or hide total size differences.
- Collapse unchanged files in the markdown report.
- Exclude unchanged files entirely.
- Options to:
-
Multi-language Support
- Supports English (
en
) and Korean (ko
) for markdown comments.
- Supports English (
-
File Ignoring
- Allows exclusion of specific files or patterns from the analysis using glob patterns.
Inputs Overview
Input Name | Description | Default Value |
---|---|---|
github_token |
GitHub token for authentication. | Required |
build_script |
The npm script to run for building your project. | build |
compression |
Compression method (gzip , brotli , or none ). |
gzip |
show_total |
Show the total size difference. | true |
collapse_unchanged |
Collapse unchanged files in the markdown report. | true |
omit_unchanged |
Exclude unchanged files from the markdown report. | false |
minimum_change_threshold |
Ignore changes below this threshold in bytes. | 10 (packages), 1000 (Next.js) |
ignore_patterns |
Glob patterns to ignore specific files or changes. | None |
language |
Language for markdown comments (en or ko ). |
en |
Example Workflow
name: Analyze Pull Request Size
on:
pull_request:
branches:
- main
jobs:
size-check:
runs-on: ubuntu-latest
steps:
- name: Run Size Action
uses: naverpay/size-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
build_script: build
compression: gzip
language: 'en'
show_total: true
collapse_unchanged: true
omit_unchanged: false
minimum_change_threshold: 1000
ignore_patterns: |
**/*.md
**/*.test.js
Known Limitations
-
Bundlephobia API Fallback:
- If Bundlephobia API fails, the action will fallback to using
npm view
for dependency size retrieval. - If both methods fail, size information will not be reported.
- If Bundlephobia API fails, the action will fallback to using
-
Compression Method:
- Compression methods (
gzip
,brotli
) require accurate build configuration for best results.
- Compression methods (
Feedback and Contribution
We welcome feedback and contributions to improve the action. Please report issues or suggestions on the [GitHub repository](#).
Let’s make monitoring and improving code size easier together! 🎉