Skip to content

Commit 4ecca81

Browse files
committed
feat: enable auto-fix for lint and formatting in CI workflow
Run eslint --fix and prettier --write before validation checks, automatically committing any fixes back to the branch. https://claude.ai/code/session_018gvgrGDfMYGubkhj9WGTQy
1 parent e0d5cbd commit 4ecca81

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,34 @@ jobs:
2020
steps:
2121
- name: Checkout code
2222
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.head_ref || github.ref_name }}
25+
token: ${{ secrets.GITHUB_TOKEN }}
2326

2427
- name: Install mise
2528
uses: jdx/mise-action@v2
2629

2730
- name: Install dependencies
2831
run: npm ci
2932

33+
- name: Auto-fix lint issues
34+
run: npm run lint:fix
35+
36+
- name: Auto-fix formatting issues
37+
run: npm run check:fix
38+
39+
- name: Commit auto-fixes if any
40+
run: |
41+
git config user.name "github-actions[bot]"
42+
git config user.email "github-actions[bot]@users.noreply.github.com"
43+
git add -A
44+
if git diff --cached --quiet; then
45+
echo "No auto-fix changes to commit"
46+
else
47+
git commit -m "chore: auto-fix lint and formatting issues"
48+
git push
49+
fi
50+
3051
- name: Lint
3152
run: npm run lint
3253

0 commit comments

Comments
 (0)