-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
chore(ci): Automatically bump size limit every week #20531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+620
−1
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a2be4e4
wekkly bump
chargome 640cc1c
.
chargome c592718
ref(ci): Always bump size-limit to currentSize + 5KB
chargome 5feaae0
Merge branch 'develop' into feat/bump-size-limits-spec
chargome 2d027a5
fix(ci): Pass --silent to yarn so size-limit JSON is parseable
chargome b48988b
ref(ci): Use peter-evans/create-pull-request for size-limit auto-bump
chargome File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| name: 'Auto-bump size-limit thresholds' | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 9 * * 5' # Friday 09:00 UTC | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| concurrency: | ||
| group: bump-size-limits | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| bump: | ||
| name: Bump size-limit thresholds | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 25 | ||
| steps: | ||
| - name: Generate GitHub App token | ||
| id: app-token | ||
| uses: actions/create-github-app-token@v2 | ||
| with: | ||
| app-id: ${{ vars.GITFLOW_APP_ID }} | ||
| private-key: ${{ secrets.GITFLOW_APP_PRIVATE_KEY }} | ||
|
|
||
| - name: Checkout develop | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: develop | ||
| token: ${{ steps.app-token.outputs.token }} | ||
|
|
||
| - name: Set up Node | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version-file: 'package.json' | ||
|
|
||
| - name: Install dependencies | ||
| uses: ./.github/actions/install-dependencies | ||
|
|
||
| - name: Build packages | ||
| run: yarn build | ||
|
|
||
| - name: Run bumper | ||
| id: bump | ||
| # Capture stdout AND exit code without failing the step on exit-2 (no-op). | ||
| run: | | ||
| set +e | ||
| node scripts/bump-size-limits.mjs > /tmp/bump-summary.md | ||
| code=$? | ||
| set -e | ||
| echo "exit_code=$code" >> "$GITHUB_OUTPUT" | ||
| if [ "$code" -ne 0 ] && [ "$code" -ne 2 ]; then | ||
| echo "::error::bump script failed with exit code $code" | ||
| cat /tmp/bump-summary.md || true | ||
| exit "$code" | ||
| fi | ||
| cat /tmp/bump-summary.md | ||
|
|
||
| - name: Commit and push | ||
| if: steps.bump.outputs.exit_code == '0' | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: | | ||
| slug=$(gh api /user --jq '.login') | ||
| id=$(gh api /user --jq '.id') | ||
| git checkout -B bot/bump-size-limits | ||
| git add .size-limit.js | ||
| git -c "user.name=$slug" \ | ||
| -c "user.email=$id+$slug@users.noreply.github.com" \ | ||
| commit -m "chore(size-limit): auto-bump weekly drift" | ||
| git push --force-with-lease origin bot/bump-size-limits | ||
|
|
||
| - name: Open or update PR | ||
| if: steps.bump.outputs.exit_code == '0' | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: | | ||
| existing=$(gh pr list --head bot/bump-size-limits --base develop --state open --json number --jq '.[0].number // empty') | ||
| if [ -n "$existing" ]; then | ||
| gh pr edit "$existing" --body-file /tmp/bump-summary.md | ||
| echo "Updated existing PR #$existing" | ||
| else | ||
| gh pr create \ | ||
| --base develop \ | ||
| --head bot/bump-size-limits \ | ||
| --title "chore(size-limit): weekly auto-bump" \ | ||
| --body-file /tmp/bump-summary.md \ | ||
| --label "Dev: CI" | ||
| fi | ||
|
|
||
| - name: Open or comment on failure issue | ||
|
chargome marked this conversation as resolved.
|
||
| if: failure() | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| run: | | ||
| title='Weekly size-limit auto-bump failure' | ||
| existing=$(gh issue list --search "in:title \"$title\"" --state open --json number,title --jq ".[] | select(.title == \"$title\") | .number" | head -n1) | ||
| if [ -n "$existing" ]; then | ||
| gh issue comment "$existing" --body "Auto-bump workflow failed again: $RUN_URL" | ||
| else | ||
| body=$(cat <<EOF | ||
| The weekly size-limit auto-bump workflow failed. | ||
|
|
||
| Run: $RUN_URL | ||
|
|
||
| This issue will be commented on for repeat failures. | ||
| EOF | ||
| ) | ||
| gh issue create \ | ||
| --title "$title" \ | ||
| --body "$body" \ | ||
| --label "Dev: CI" | ||
| fi | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| module.exports = [ | ||
| { | ||
| name: '@sentry/browser', | ||
| path: 'packages/browser/build/npm/esm/prod/index.js', | ||
| gzip: true, | ||
| limit: '27 KB', | ||
| }, | ||
| { | ||
| name: '@sentry/browser - with treeshaking flags', | ||
| path: 'packages/browser/build/npm/esm/prod/index.js', | ||
| gzip: true, | ||
| limit: '25 KB', | ||
| }, | ||
| { | ||
| name: 'CDN Bundle (incl. Tracing)', | ||
| path: 'packages/browser/build/bundles/bundle.tracing.min.js', | ||
| gzip: true, | ||
| limit: '46.5 KB', | ||
| }, | ||
| { | ||
| name: '@sentry/cloudflare (withSentry)', | ||
| path: 'packages/cloudflare/build/esm/index.js', | ||
| gzip: false, | ||
| brotli: false, | ||
| limit: '420 KiB', | ||
| }, | ||
| ]; |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.