File tree Expand file tree Collapse file tree 1 file changed +24
-31
lines changed
Expand file tree Collapse file tree 1 file changed +24
-31
lines changed Original file line number Diff line number Diff line change 11name : Formatting
22
3- on :
3+ on :
44 push :
5- branches : [main] # or any branch you want to watch
6- paths :
7- - ' **.lua'
8- pull_request :
9- paths :
10- - ' **.lua'
5+ branches : [ "main" ]
6+ paths-ignore :
7+ - " .github/**"
8+ - " **.md"
9+ - " **.norg"
1110
1211jobs :
13- format :
12+ format-with-stylua :
1413 runs-on : ubuntu-latest
15-
1614 steps :
17- - name : Checkout code
18- uses : actions/checkout@v3
19- with :
20- token : ${{ secrets.GITHUB_TOKEN }}
15+ - uses : actions/checkout@v2
2116
22- - name : Set up Lua
23- uses : leafo/gh-actions-lua@v9
17+ - name : Install cargo
18+ run : curl https://sh.rustup.rs -sSf | sh -s -- -y
2419
25- - name : Install Stylua
26- run : |
27- curl -L https://github.com/JohnnyMorganz/StyLua/releases/latest/download/stylua-linux-x86_64.zip -o stylua.zip
28- unzip stylua.zip -d stylua-bin
29- sudo mv stylua-bin/stylua /usr/local/bin/
30- stylua --version
20+ - name : Install stylua
21+ run : cargo install stylua --features lua52
3122
32- - name : Run Stylua formatter
33- run : |
34- stylua .
23+ - name : Run formatting
24+ run : stylua -v --verify .
3525
36- - name : Commit formatted code (if changed)
37- run : |
38- git config user.name "github-actions"
39- git config user.email "github-actions@github.com"
40- git add .
41- git diff --cached --quiet || git commit -m "chore: auto-format Lua code with Stylua"
42- git push
26+ - uses : stefanzweifel/git-auto-commit-action@v4
27+ with :
28+ commit_message : " chore: autoformat with stylua"
29+ branch : ${{ github.ref }}
30+
31+ - name : Push changes
32+ uses : ad-m/github-push-action@master
33+ with :
34+ github_token : ${{ secrets.GITHUB_TOKEN }}
35+ branch : ${{ github.ref }}
You can’t perform that action at this time.
0 commit comments