diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml index 4421a7e0320..2853df13ad0 100644 --- a/.github/workflows/luacheck.yml +++ b/.github/workflows/luacheck.yml @@ -65,3 +65,31 @@ jobs: report_paths: 'busted.xml' check_name: 'Lua Test Report' annotate_only: ${{ (github.event.pull_request.head.repo.full_name != github.repository) }} + + luals-code-style: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + + - id: lua-changed-files + uses: tj-actions/changed-files@v42 + with: + files: | + lua/wikis/**/*.lua + + - name: Setup LuaLS + if: steps.lua-changed-files.outputs.any_changed == 'true' + run: | + mkdir -p ~/.local/bin/luals + curl -L https://github.com/LuaLS/lua-language-server/releases/download/3.17.1/lua-language-server-3.17.1-linux-x64.tar.gz | tar -xzv -C ~/.local/bin/luals + + - name: Check + if: steps.lua-changed-files.outputs.any_changed == 'true' + shell: bash + run: | + ~/.local/bin/luals/bin/lua-language-server --check ./ | tee luals-check && true + cat luals-check | (sed -e 's/\x1b\[[0-9;]*m//g'| sed -n 's/\(lua[^:]\+\):\([[:digit:]]*\):[[:digit:]]* \[Warning\] /::error file=\1,line=\2::/p') | (! grep -E $(echo ${{ steps.lua-changed-files.outputs.all_changed_files }} | sed -- 's/ /|/')) + echo "| | Files | Errors |" >> $GITHUB_STEP_SUMMARY + echo "|-|-------|----------|" >> $GITHUB_STEP_SUMMARY + echo "| LuaLS check | $(find lua -name '*.lua' | wc -l) | $(cat luals-check | grep 'Warning' | wc -l) |" >> $GITHUB_STEP_SUMMARY diff --git a/lua/wikis/ageofempires/PrizePool/Custom.lua b/lua/wikis/ageofempires/PrizePool/Custom.lua index 09e04f694a6..f52f05582d8 100644 --- a/lua/wikis/ageofempires/PrizePool/Custom.lua +++ b/lua/wikis/ageofempires/PrizePool/Custom.lua @@ -33,8 +33,7 @@ function CustomPrizePool.run(frame) args.syncPlayers = true args.import = Logic.nilOr(Logic.readBoolOrNil(args.import), false) - local prizePool = PrizePool(args) - :create() + local prizePool = PrizePool(args):create() prizePool:setLpdbInjector(CustomLpdbInjector())