File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ # This workflow runs on every push and automatically applies formatting using mise format
2+ name : Auto-format code
3+
4+ concurrency :
5+ group : ${{ github.workflow }}-${{ github.ref }}
6+ cancel-in-progress : true
7+
8+ on :
9+ push :
10+ branches :
11+ - " **"
12+
13+ jobs :
14+ format :
15+ runs-on : ubuntu-slim
16+ # Skip if commit is already from this auto-format workflow to avoid infinite loops
17+ if : " !contains(github.event.head_commit.message, '[LeshyBot] Apply automatic formatting')"
18+ steps :
19+ - uses : actions/create-github-app-token@v2
20+ id : generate-token
21+ with :
22+ app-id : ${{ secrets.LESHY_APP_ID }}
23+ private-key : ${{ secrets.LESHY_APP_PRIVATE_KEY }}
24+
25+ - uses : actions/checkout@v6
26+ with :
27+ token : ${{ steps.generate-token.outputs.token }}
28+ fetch-depth : 0
29+
30+ - uses : jdx/mise-action@v3
31+ - run : mise format
32+
33+ - name : Check for changes
34+ id : check-changes
35+ run : |
36+ if [[ -n $(git status --porcelain) ]]; then
37+ echo "has_changes=true" >> $GITHUB_OUTPUT
38+ else
39+ echo "has_changes=false" >> $GITHUB_OUTPUT
40+ fi
41+
42+ - name : Commit and push formatting changes
43+ if : steps.check-changes.outputs.has_changes == 'true'
44+ run : |
45+ git config user.name "LeshyBot"
46+ git add .
47+ git commit -m "[LeshyBot] Apply automatic formatting"
48+ git push
You can’t perform that action at this time.
0 commit comments