Skip to content

Commit 3068d54

Browse files
fix: auto-format Release Please PRs with Prettier
Add a workflow that automatically formats CHANGELOG.md and other files when Release Please creates or updates a release PR. This ensures the release PR passes formatting checks without manual intervention. The workflow: - Triggers on PRs to main branch - Only runs on Release Please branches (release-please--*) - Installs dependencies and runs prettier - Auto-commits formatting changes if needed 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent d55a043 commit 3068d54

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Format Release PR
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
format:
10+
# Only run on Release Please PRs
11+
if: startsWith(github.head_ref, 'release-please--')
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Checkout PR
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.head_ref }}
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version-file: .nvmrc
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Format files
31+
run: npm run format-fix
32+
33+
- name: Commit formatting changes
34+
run: |
35+
git config --global user.name 'github-actions[bot]'
36+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
37+
git add -A
38+
git diff --staged --quiet || git commit -m "chore: auto-format with prettier"
39+
git push

0 commit comments

Comments
 (0)