Skip to content

Commit f379820

Browse files
committed
style: add lua linter
1 parent be61dcd commit f379820

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

.github/workflows/lint-lua.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: lua-style
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ develop, release ]
7+
#pull_request:
8+
# branches: [ develop, release ]
9+
10+
# minimal perms to allow auto-commit on push
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
lua-style:
16+
name: style linters
17+
if: ${{ github.actor != 'dependabot[bot]' }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Check out Git repository
21+
uses: actions/checkout@v5
22+
with:
23+
# lets auto-commit push back to the same branch
24+
ref: ${{ github.head_ref }}
25+
26+
# Formatting (StyLua)
27+
# check-only on PRs
28+
- name: StyLua (check)
29+
if: ${{ github.event_name == 'pull_request' }}
30+
uses: JohnnyMorganz/stylua-action@v4
31+
with:
32+
token: ${{ secrets.IKEMEN_TOKEN }}
33+
version: v0.20.0
34+
args: >
35+
--check
36+
--syntax Lua51
37+
--column_width 120
38+
--line_endings Unix
39+
--indent_type Tabs
40+
--indent_width 4
41+
--quote_style AutoPreferSingle # AutoPreferDouble
42+
--call_parentheses Always
43+
--space_after_function_names Never
44+
--block_newline_gaps Never
45+
--collapse_simple_statement Never
46+
47+
# write fixes on branch pushes
48+
- name: StyLua (write)
49+
if: ${{ github.event_name != 'pull_request' }}
50+
uses: JohnnyMorganz/stylua-action@v4
51+
with:
52+
token: ${{ secrets.IKEMEN_TOKEN }}
53+
version: v0.20.0
54+
args: .
55+
56+
# Linting (Luacheck)
57+
- name: Luacheck
58+
uses: lunarmodules/luacheck@v1
59+
continue-on-error: true
60+
with:
61+
# pass extra args if you have a .luacheckrc
62+
args: . --no-color --ignore 111 --ignore 112 --ignore 113 --ignore 142 --ignore 143
63+
64+
# Commit format changes on push
65+
- name: Commit formatting changes
66+
if: ${{ github.event_name != 'pull_request' }}
67+
uses: stefanzweifel/git-auto-commit-action@v5
68+
with:
69+
commit_message: "style(lua): fix code style issues with StyLua"
70+
commit_user_name: lint-action
71+
commit_user_email: 59283862+lint-action@users.noreply.github.com
72+
commit_author: "lint-action <59283862+lint-action@users.noreply.github.com>"
73+
file_pattern: "**/*.lua"

0 commit comments

Comments
 (0)