Skip to content

File sync from bmos/fg-workflows #79

File sync from bmos/fg-workflows

File sync from bmos/fg-workflows #79

Workflow file for this run

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@1.2.1
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@v6
with:
string: ${{ steps.removenamespaces.outputs.value }}
# Determine extension author
- name: Get Author Name from XML
id: getauthorfromxml
uses: mavrosxristoforos/get-xml-info@1.2.1
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@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'