Skip to content

Commit 6c7d511

Browse files
committed
style: lua linter
1 parent be61dcd commit 6c7d511

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

.github/.stylua.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
syntax = "Lua51"
2+
column_width = 1000
3+
line_endings = "Unix"
4+
indent_type = "Tabs"
5+
indent_width = 4
6+
quote_style = "AutoPreferSingle"
7+
call_parentheses = "Input"
8+
space_after_function_names = "Never"
9+
block_newline_gaps = "Never"
10+
collapse_simple_statement = "Never"

.github/workflows/lint-lua.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: lua-style
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ develop, release, test ]
7+
#pull_request:
8+
# branches: [ develop, release, test ]
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: v2.3.1
34+
args: --config-path .github/.stylua.toml --check .
35+
36+
# write fixes on branch pushes
37+
- name: StyLua (write)
38+
if: ${{ github.event_name != 'pull_request' }}
39+
uses: JohnnyMorganz/stylua-action@v4
40+
with:
41+
token: ${{ secrets.IKEMEN_TOKEN }}
42+
version: v2.3.1
43+
args: --config-path .github/.stylua.toml .
44+
45+
# Linting (Luacheck)
46+
- name: Luacheck
47+
uses: lunarmodules/luacheck@v1
48+
continue-on-error: true
49+
with:
50+
# pass extra args if you have a .luacheckrc
51+
args: . --no-color --ignore 111 --ignore 112 --ignore 113 --ignore 142 --ignore 143
52+
53+
# Commit format changes on push
54+
- name: Commit formatting changes
55+
if: ${{ github.event_name != 'pull_request' }}
56+
uses: stefanzweifel/git-auto-commit-action@v5
57+
with:
58+
commit_message: "style(lua): fix code style issues with StyLua"
59+
commit_user_name: lint-action
60+
commit_user_email: 59283862+lint-action@users.noreply.github.com
61+
commit_author: "lint-action <59283862+lint-action@users.noreply.github.com>"
62+
file_pattern: "**/*.lua"

0 commit comments

Comments
 (0)