-
Notifications
You must be signed in to change notification settings - Fork 2
142 lines (122 loc) · 4.21 KB
/
luacheck.yml
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
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.
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.
workflow_dispatch:
name: Run Luacheck
jobs:
getnames:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
# Determine extension name
- name: Get Extension Name from XML
id: getnamefromxml
uses: mavrosxristoforos/[email protected]
with:
xml-file: 'extension.xml'
xpath: '//properties//name'
- name: Format Extension Name
id: removenameprefix
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.getnamefromxml.outputs.info }}
regex: '[A-Za-z]+:\s+'
replacement: ''
- id: removenametabs
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.removenameprefix.outputs.value }}
regex: " "
replacement: ''
- id: removeapostrophes
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.removenametabs.outputs.value }}
regex: "'"
replacement: ''
- id: removenamepunctuation
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.removeapostrophes.outputs.value }}
regex: '[^\w\s].*'
replacement: ''
- id: removenamespaces
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.removenamepunctuation.outputs.value }}
regex: '\s'
replacement: ''
- id: namelowercase
uses: ASzc/change-string-case-action@v5
with:
string: ${{ steps.removenamespaces.outputs.value }}
# Determine extension author
- name: Get Author Name from XML
id: getauthorfromxml
uses: mavrosxristoforos/[email protected]
with:
xml-file: 'extension.xml'
xpath: '//properties//author'
- name: Format author name
id: removeauthorprefix
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.getauthorfromxml.outputs.info }}
regex: '[A-Za-z]+:\s'
replacement: ''
- id: removeauthortabs
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.removeauthorprefix.outputs.value }}
regex: " "
replacement: ''
- id: removeauthorapostrophes
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.removeauthortabs.outputs.value }}
regex: "'"
replacement: ''
- id: removeauthorpunctuation
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.removeauthorapostrophes.outputs.value }}
regex: '[^\w\s].*'
replacement: ''
- id: removeauthorspaces
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.removeauthorpunctuation.outputs.value }}
regex: '\s'
replacement: ''
- id: authorlowercase
uses: ASzc/change-string-case-action@v5
with:
string: ${{ steps.removeauthorspaces.outputs.value }}
outputs:
extension: ${{ steps.namelowercase.outputs.lowercase }}
author: ${{ steps.authorlowercase.outputs.lowercase }}
luacheck:
runs-on: ubuntu-latest
needs: getnames
steps:
- name: Checkout default branch
uses: actions/checkout@v3
- name: Install Lua/LuaJIT
uses: leafo/gh-actions-lua@v9
with:
luaVersion: 5.1
# Process extension code
- name: Running luacheck
uses: nebularg/actions-luacheck@v1
with:
files: '.'
config: https://raw.githubusercontent.com/bmos/FG-luacheck/main/.luacheckrc
args: '--no-color --std +${{ needs.getnames.outputs.extension }}${{ needs.getnames.outputs.author }} --exclude-files .install/*'
annotate: 'warning'