Skip to content

Commit b48988b

Browse files
chargomeclaude
andcommitted
ref(ci): Use peter-evans/create-pull-request for size-limit auto-bump
Replace the manual git checkout/commit/push and gh pr create/edit steps with peter-evans/create-pull-request, which is already used in external-contributors.yml. The action handles the no-diff (no-op) case itself, so we no longer need the exit-code branching for PR creation — the bumper still exits 2 on no-op for stdout/log purposes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2d027a5 commit b48988b

1 file changed

Lines changed: 14 additions & 33 deletions

File tree

.github/workflows/bump-size-limits.yml

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -45,52 +45,33 @@ jobs:
4545
run: yarn build
4646

4747
- name: Run bumper
48-
id: bump
4948
# Capture stdout AND exit code without failing the step on exit-2 (no-op).
49+
# The script writes .size-limit.js in place; create-pull-request handles
50+
# commit/branch/PR — if there's no diff, it skips opening a PR.
5051
run: |
5152
set +e
5253
node scripts/bump-size-limits.mjs > /tmp/bump-summary.md
5354
code=$?
5455
set -e
55-
echo "exit_code=$code" >> "$GITHUB_OUTPUT"
5656
if [ "$code" -ne 0 ] && [ "$code" -ne 2 ]; then
5757
echo "::error::bump script failed with exit code $code"
5858
cat /tmp/bump-summary.md || true
5959
exit "$code"
6060
fi
6161
cat /tmp/bump-summary.md
6262
63-
- name: Commit and push
64-
if: steps.bump.outputs.exit_code == '0'
65-
env:
66-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
67-
run: |
68-
slug=$(gh api /user --jq '.login')
69-
id=$(gh api /user --jq '.id')
70-
git checkout -B bot/bump-size-limits
71-
git add .size-limit.js
72-
git -c "user.name=$slug" \
73-
-c "user.email=$id+$slug@users.noreply.github.com" \
74-
commit -m "chore(size-limit): auto-bump weekly drift"
75-
git push --force-with-lease origin bot/bump-size-limits
76-
77-
- name: Open or update PR
78-
if: steps.bump.outputs.exit_code == '0'
79-
env:
80-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
81-
run: |
82-
existing=$(gh pr list --head bot/bump-size-limits --base develop --state open --json number --jq '.[0].number // empty')
83-
if [ -n "$existing" ]; then
84-
gh pr edit "$existing" --body-file /tmp/bump-summary.md
85-
echo "Updated existing PR #$existing"
86-
else
87-
gh pr create \
88-
--base develop \
89-
--head bot/bump-size-limits \
90-
--title "chore(size-limit): weekly auto-bump" \
91-
--body-file /tmp/bump-summary.md \
92-
--label "Dev: CI"
93-
fi
63+
- name: Create or update PR
64+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
65+
with:
66+
token: ${{ steps.app-token.outputs.token }}
67+
commit-message: 'chore(size-limit): auto-bump weekly drift'
68+
title: 'chore(size-limit): weekly auto-bump'
69+
body-path: /tmp/bump-summary.md
70+
branch: bot/bump-size-limits
71+
base: develop
72+
labels: 'Dev: CI'
73+
add-paths: '.size-limit.js'
74+
delete-branch: true
9475

9576
- name: Open or comment on failure issue
9677
if: failure()

0 commit comments

Comments
 (0)