File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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-24.04-arm
16+ # Only run on the main repo, skip forks
17+ # Skip if commit is already from this auto-format workflow to avoid infinite loops
18+ if : github.repository == 'ChainSafe/forest' && !contains(github.event.head_commit.message, '[LeshyBot] Apply automatic formatting')
19+ steps :
20+ - uses : actions/create-github-app-token@v2
21+ id : generate-token
22+ with :
23+ app-id : ${{ secrets.LESHY_APP_ID }}
24+ private-key : ${{ secrets.LESHY_APP_PRIVATE_KEY }}
25+
26+ - uses : actions/checkout@v6
27+ with :
28+ token : ${{ steps.generate-token.outputs.token }}
29+ fetch-depth : 0
30+
31+ - uses : jdx/mise-action@v3
32+ - run : mise format
33+
34+ - name : Check for changes
35+ id : check-changes
36+ run : |
37+ if [[ -n $(git status --porcelain) ]]; then
38+ echo "has_changes=true" >> $GITHUB_OUTPUT
39+ else
40+ echo "has_changes=false" >> $GITHUB_OUTPUT
41+ fi
42+
43+ - name : Commit and push formatting changes
44+ if : steps.check-changes.outputs.has_changes == 'true'
45+ run : |
46+ git config user.name "LeshyBot"
47+ git add .
48+ git commit -m "[LeshyBot] Apply automatic formatting"
49+ git push
You can’t perform that action at this time.
0 commit comments