Skip to content

Commit

Permalink
Formatting/Luacheck
Browse files Browse the repository at this point in the history
  • Loading branch information
rhagelstrom committed Feb 17, 2023
1 parent 8572ce9 commit 6fab860
Show file tree
Hide file tree
Showing 6 changed files with 315 additions and 182 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Build FG-Usable File
name: Build FG Extension

env:
EXTENSION: '.ext'
Expand Down
128 changes: 128 additions & 0 deletions .github/workflows/luacheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
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/get-xml-info@1.1.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: removeapostrophes
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.removenameprefix.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 Extension Name from XML
id: getauthorfromxml
uses: mavrosxristoforos/get-xml-info@1.1.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: removeauthorapostrophes
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.removeauthorprefix.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/rhagelstrom/FG-luacheck/main/.luacheckrc
args: '--no-color --std +${{ needs.getnames.outputs.extension }}${{ needs.getnames.outputs.author }} --exclude-files .install/*'
annotate: 'warning'
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[![Build FG Extension](https://github.com/rhagelstrom/PowerUp/actions/workflows/create-release.yml/badge.svg)](https://github.com/rhagelstrom/PowerUp/actions/workflows/create-release.yml) [![Luacheckrc](https://github.com/rhagelstrom/PowerUp/actions/workflows/luacheck.yml/badge.svg)](https://github.com/rhagelstrom/PowerUp/actions/workflows/luacheck.yml)
# Power Up

**Current Version:** 1.5
**Updated::** 10/10/22
**Current Version:** 1.6
**Updated::** 02/17/23

Power Up is Fantasy Grounds extension that allows a user to see the name of extensions that have been updated since the last time the campaign was loaded. Power Up also allows for customization and control of the loading on player modules by the GM.

Expand Down
11 changes: 5 additions & 6 deletions extension.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<?xml version="1.0" encoding="iso-8859-1"?>

<root release="3.0" version="3">
<announcement text="https://www.fantasygrounds.com/forums/showthread.php?74616-Power-Up\rPower Up v1.5 by Ryan Hagelstrom\rContribution: bmos 2022\rtype: /powerup /powerupman" icon="PowerUp" font="emotefont"/>
<announcement text="https://www.fantasygrounds.com/forums/showthread.php?74616-Power-Up\rPower Up v1.6 by Ryan Hagelstrom\rContribution: bmos 2022-2023\rtype: /powerup /powerupman" icon="PowerUp" font="emotefont" />
<properties>
<loadorder>10</loadorder>
<loadorder>10</loadorder>
<name>Feature: Power Up</name>
<version>1.5</version>
<version>1.6</version>
<author>Ryan Hagelstrom</author>
<description>Show what extensions have been updated since last campaign as well as some GM module managment of players</description>
<description>Show what extensions have been updated since last campaign as well as some GM module management of players</description>
</properties>
<base>
<script name="PowerUp" file="scripts/PowerUp.lua" />
<includefile source="strings/strings.xml" />
<includefile source="graphics/graphics.xml" />
</base>
</base>
</root>
Loading

0 comments on commit 6fab860

Please sign in to comment.