Skip to content

Commit d8ae468

Browse files
committed
feat(ci): autoformat commits
1 parent 6dd4826 commit d8ae468

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/auto-format.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
permissions:
17+
# Give the default GITHUB_TOKEN write permission to commit and push the
18+
# added or changed files to the repository.
19+
contents: write
20+
# Only run on the main repo, skip forks
21+
# Skip if commit is already from this auto-format workflow to avoid infinite loops
22+
if: github.repository == 'ChainSafe/forest' && !contains(github.event.head_commit.message, '[LeshyBot] Apply automatic formatting')
23+
steps:
24+
- uses: actions/create-github-app-token@v2
25+
id: generate-token
26+
with:
27+
app-id: ${{ secrets.LESHY_APP_ID }}
28+
private-key: ${{ secrets.LESHY_APP_PRIVATE_KEY }}
29+
30+
- uses: actions/checkout@v6
31+
with:
32+
token: ${{ steps.generate-token.outputs.token }}
33+
fetch-depth: 0
34+
35+
- uses: jdx/mise-action@v3
36+
- run: mise install-lint-tools
37+
- run: mise format
38+
39+
- name: Commit and push formatting changes
40+
uses: stefanzweifel/git-auto-commit-action@v5
41+
with:
42+
commit_message: "[LeshyBot] Apply automatic formatting"
43+
commit_user_name: "leshyatwork[bot]"
44+
commit_user_email: "217592034+leshyatwork[bot]@users.noreply.github.com"
45+
commit_author: "leshyatwork[bot] <217592034+leshyatwork[bot]@users.noreply.github.com>"

0 commit comments

Comments
 (0)