-
Notifications
You must be signed in to change notification settings - Fork 1
154 lines (133 loc) · 4.57 KB
/
lua.yml
File metadata and controls
154 lines (133 loc) · 4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
on:
push:
paths:
- '**.lua' # Run if pushed commits include a change to a Lua (.lua) file.
- 'extension.xml' # Run if pushed commits include a change to extension.xml.
- '.stylua' # Run if pushed commits include a change to .stylua.
- '.github/workflows/lua.yml' # Run if pushed commits change this workflow.
pull_request:
paths:
- '**.lua' # Run if pull request includes a change to a Lua (.lua) file.
- 'extension.xml' # Run if pull request includes a change to extension.xml.
- '.stylua' # Run if pushed commits include a change to .stylua.
schedule:
- cron: '0 9 * * 1'
workflow_dispatch:
name: Check Lua Code
jobs:
stylua:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --config-path .stylua.toml --check .
luacheck:
runs-on: ubuntu-latest
steps:
- name: Checkout default branch
uses: actions/checkout@v4
# Determine extension name
- name: Get Extension Name from XML
id: getnamefromxml
uses: mavrosxristoforos/get-xml-info@2.0
with:
xml-file: 'extension.xml'
xpath: '//properties//name'
- name: Format Extension Name
id: removenameprefix
uses: bmos/regex-property-action@v1
with:
value: ${{ steps.getnamefromxml.outputs.info }}
regex: '[A-Za-z]+:\s+'
replacement: ''
- id: removenametabs
uses: bmos/regex-property-action@v1
with:
value: ${{ steps.removenameprefix.outputs.value }}
regex: " "
replacement: ''
- id: removeapostrophes
uses: bmos/regex-property-action@v1
with:
value: ${{ steps.removenametabs.outputs.value }}
regex: "'"
replacement: ''
- id: removenamepunctuation
uses: bmos/regex-property-action@v1
with:
value: ${{ steps.removeapostrophes.outputs.value }}
regex: '[^\w\s].*'
replacement: ''
- id: removenamespaces
uses: bmos/regex-property-action@v1
with:
value: ${{ steps.removenamepunctuation.outputs.value }}
regex: '\s'
replacement: ''
- id: namelowercase
uses: ASzc/change-string-case-action@v6
with:
string: ${{ steps.removenamespaces.outputs.value }}
# Determine extension author
- name: Get Author Name from XML
id: getauthorfromxml
uses: mavrosxristoforos/get-xml-info@2.0
with:
xml-file: 'extension.xml'
xpath: '//properties//author'
- name: Format author name
id: removeauthorprefix
uses: bmos/regex-property-action@v1
with:
value: ${{ steps.getauthorfromxml.outputs.info }}
regex: '[A-Za-z]+:\s'
replacement: ''
- id: removeauthortabs
uses: bmos/regex-property-action@v1
with:
value: ${{ steps.removeauthorprefix.outputs.value }}
regex: " "
replacement: ''
- id: removeauthorapostrophes
uses: bmos/regex-property-action@v1
with:
value: ${{ steps.removeauthortabs.outputs.value }}
regex: "'"
replacement: ''
- id: removeauthorpunctuation
uses: bmos/regex-property-action@v1
with:
value: ${{ steps.removeauthorapostrophes.outputs.value }}
regex: '[^\w\s].*'
replacement: ''
- id: removeauthorspaces
uses: bmos/regex-property-action@v1
with:
value: ${{ steps.removeauthorpunctuation.outputs.value }}
regex: '\s'
replacement: ''
- id: authorlowercase
uses: ASzc/change-string-case-action@v6
with:
string: ${{ steps.removeauthorspaces.outputs.value }}
- name: Install Lua/LuaJIT
uses: leafo/gh-actions-lua@v10
with:
luaVersion: 5.1
- id: cache-luacheck
uses: actions/cache@v4
with:
path: ~/.config/luacheck
key: luacheck
# Process extension code
- name: Running luacheck
uses: nebularg/actions-luacheck@v1
with:
files: '.'
config: https://raw.githubusercontent.com/FG-Unofficial-Developers-Guild/FG-luacheck/main/.luacheckrc
args: '--no-color --std +${{ steps.namelowercase.outputs.lowercase }}${{ steps.authorlowercase.outputs.lowercase }} --exclude-files .install/*'
annotate: 'warning'