-
Notifications
You must be signed in to change notification settings - Fork 37
63 lines (55 loc) · 1.63 KB
/
format.yml
File metadata and controls
63 lines (55 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Auto Format
on:
workflow_run:
workflows: ['validate']
types:
- completed
branches: ['main']
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
format:
name: 🧹 Auto Format
runs-on: ubuntu-latest
timeout-minutes: 10
# Only run if the validate workflow completed successfully and was triggered by a push to main
if:
${{ github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' }}
permissions:
contents: write
actions: write
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: 📥 Download deps
run: npm install --prefer-offline --no-audit --no-fund
- name: 🔧 Configure git
run: |
git config --global user.email "me+bot@kentcdodds.com"
git config --global user.name "Kody 🐨"
- name: 🎨 Run Prettier
run:
npx prettier --write "**/*.{js,jsx,ts,tsx,md,css}" --ignore-path
.prettierignore
- name: 🔍 Run ESLint --fix
run: npm run lint -- --fix
- name: 💾 Commit changes
run: |
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "chore: cleanup 🧹"
git push
echo "Changes committed and pushed."
else
echo "No changes to commit."
fi