This GitHub Action runs luacheck on your Lua codebase against known FiveM natives for any GitHub repository!
Now supports FiveM Lua backtick syntax.
To use this in your GitHub repository, create the following file:
.github/workflows/lint.yml
name: Lint
on: [push, pull_request]
jobs:
lint:
name: Lint Resource
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint
uses: Red40-Development/fivem-lua-lint-action@v3This will automatically run luacheck for both commits and pull requests!
You can customize behavior per-run without rebuilding the action image:
paths: Which files/folders to lint.args: Extraluacheckargs.config_path: Optional custom config file. If omitted, the embedded default config is used.extra_libs: Extra standards suffixes (format:a+b+c) injected at runtime.
Example with custom path/config/extras:
name: Lint
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint
uses: Red40-Development/fivem-lua-lint-action@v3
with:
paths: "client/ server/"
extra_libs: "ox_lib+qbox"You can run this action image locally against a resource folder to validate lint behavior before pushing.
If you are developing this repository locally:
docker build -t ghcr.io/red40-development/fivem-lua-lint-action .docker run --rm \
-v "$PWD:/work" \
-w /work \
ghcr.io/red40-development/fivem-lua-lint-action \
"-t" "." "" "" "false" ""docker run --rm \
-v "$PWD:/work" \
-w /work \
ghcr.io/red40-development/fivem-lua-lint-action \
"-t" "." "" "" "false" "ox_lib+qbox"The positional arguments map to action inputs in this order:
argspathsconfig_pathcapturefail_on_warningsextra_libs
Notes:
- Leave
config_pathempty ("") to use the embedded default config. - Use
extra_libsin the formata+b+c(example:ox_lib+mysql+qbox). - Set
fail_on_warningstotrueif you want non-zero exit on lint warnings.
If you would like to display fancy results in the GitHub action job, you can try the following configuration, which outputs a JUnit results file:
.github/workflows/lint.yml
name: Lint
on: [push, pull_request]
jobs:
lint:
name: Lint Resource
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Lint
uses: Red40-Development/fivem-lua-lint-action@v3
with:
capture: "junit.xml"
args: "-t --formatter JUnit"
- name: Generate Lint Report
if: always()
uses: mikepenz/action-junit-report@v3
with:
report_paths: "**/junit.xml"
check_name: Linting Report
fail_on_failure: false
