updates for new rulesets #76
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | |
- '.github/workflows/luacheck.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. | |
workflow_dispatch: | |
name: Run Luacheck | |
jobs: | |
getnames: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
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 }} | |
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@v4 | |
- name: Install Lua/LuaJIT | |
uses: leafo/gh-actions-lua@v10 | |
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' |