File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 9
9
- main
10
10
11
11
permissions :
12
- contents : read
12
+ contents : write
13
+ pull-requests : write
13
14
14
15
jobs :
15
16
test :
24
25
steps :
25
26
- name : Checkout code
26
27
uses : actions/checkout@v4
28
+ with :
29
+ token : ${{ secrets.GITHUB_TOKEN }}
30
+ fetch-depth : 0
27
31
28
32
- name : Setup Node.js ${{ matrix.node-version }}
29
33
uses : actions/setup-node@v4
41
45
run : |
42
46
npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }}
43
47
48
+ - name : Lint and auto-fix code
49
+ id : lint
50
+ run : |
51
+ # First try to apply fixes
52
+ yarn format || true
53
+ yarn lint:fix || true
54
+
55
+ # Check if there are any changes
56
+ if [[ -n $(git status --porcelain) ]]; then
57
+ echo "has_changes=true" >> $GITHUB_OUTPUT
58
+ else
59
+ echo "has_changes=false" >> $GITHUB_OUTPUT
60
+ fi
61
+
62
+ # Run lint check to see if issues remain
63
+ yarn lint
64
+
65
+ - name : Commit and push lint fixes
66
+ if : steps.lint.outputs.has_changes == 'true' && github.event_name == 'push' && matrix.node-version == '20'
67
+ run : |
68
+ git config user.name "github-actions[bot]"
69
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
70
+ git add -A
71
+ git commit -m "style: apply automatic lint fixes [skip ci]"
72
+ git push
73
+
74
+ - name : Commit lint fixes to PR
75
+ if : steps.lint.outputs.has_changes == 'true' && github.event_name == 'pull_request' && matrix.node-version == '20'
76
+ uses : EndBug/add-and-commit@v9
77
+ with :
78
+ author_name : github-actions[bot]
79
+ author_email : 41898282+github-actions[bot]@users.noreply.github.com
80
+ message : ' style: apply automatic lint fixes'
81
+ push : true
82
+
44
83
- name : Type check
45
84
run : npx tsc --noEmit
46
85
Original file line number Diff line number Diff line change 14
14
"test" : " vitest run --coverage" ,
15
15
"test:watch" : " vitest --watch" ,
16
16
"test:ci" : " vitest run --coverage --reporter=json --reporter=default" ,
17
+ "lint" : " biome check ." ,
18
+ "lint:fix" : " biome check --write ." ,
19
+ "format" : " biome format --write ." ,
17
20
"prepare" : " npm run build" ,
18
21
"prepublishOnly" : " npm test && npm run build" ,
19
22
"start" : " node dist/index.js"
You can’t perform that action at this time.
0 commit comments