Skip to content

Update dependency @remoteoss/remote-json-schema-form-kit to v0.0.10 - autoclosed #790

Update dependency @remoteoss/remote-json-schema-form-kit to v0.0.10 - autoclosed

Update dependency @remoteoss/remote-json-schema-form-kit to v0.0.10 - autoclosed #790

Workflow file for this run

name: Bundle Size Check
on:
pull_request:
branches:
- main
paths:
- 'src/**'
- 'package.json'
- 'package-lock.json'
- 'tsup.config.ts'
- '.sizelimit.json'
permissions:
contents: read
pull-requests: write
jobs:
size-check:
runs-on: ubuntu-latest
name: Check bundle size
steps:
- name: Checkout PR code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build current branch
run: npm run build
- name: Analyze current bundle size
run: npm run size -- --output out/current-bundle.json
- name: Checkout base branch
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
path: base
- name: Check if comparison script exists on base
id: check_script
run: |
if [ -f "base/scripts/compare-sizes.ts" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "⚠️ Comparison script not found on base branch. Skipping size comparison."
fi
- name: Install dependencies (base)
if: steps.check_script.outputs.exists == 'true'
working-directory: base
run: npm ci
- name: Build base branch
if: steps.check_script.outputs.exists == 'true'
working-directory: base
run: npm run build
- name: Analyze base bundle size
if: steps.check_script.outputs.exists == 'true'
working-directory: base
run: npm run size -- --output ../out/base-bundle.json
- name: Compare bundle sizes
id: compare
run: |
# Check if we have comparison data
if [ "${{ steps.check_script.outputs.exists }}" != "true" ]; then
echo "⚠️ Comparison script not found in base branch. Showing current bundle size only."
npm exec tsx scripts/format-current-size.ts out/current-bundle.json > out/size-report.md
else
# Run comparison and capture output
npm exec tsx scripts/compare-sizes.ts out/base-bundle.json out/current-bundle.json > out/size-report.md 2>&1 || true
fi
# Read the report for the PR comment
REPORT=$(cat out/size-report.md)
# Set output for PR comment (escape for GitHub Actions)
echo "report<<EOF" >> $GITHUB_OUTPUT
echo "$REPORT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Post PR comment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const report = process.env.SIZE_REPORT;
// Find existing comment
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.find(comment =>
comment.user.type === 'Bot' &&
comment.body.includes('📦 Bundle Size Report')
);
const commentBody = report;
if (botComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: commentBody
});
} else {
// Create new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: commentBody
});
}
env:
SIZE_REPORT: ${{ steps.compare.outputs.report }}
- name: Check size limits
run: npm run size:check
- name: Upload bundle analysis
uses: actions/upload-artifact@v4
if: always()
with:
name: bundle-size-analysis
path: |
out/current-bundle.json
out/base-bundle.json
out/size-report.md
retention-days: 30