├── stderr.txt ├── stdout.txt ├── .luacheckrc ├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ ├── versioning.yml │ ├── typecheck.yml │ ├── auto-merge.yml │ ├── update.yml │ └── release-please.yml ├── .hadolint.yaml ├── .stylua.toml ├── .luarc.json ├── CONTRIBUTING.md ├── .gitignore ├── lua-typecheck-action-scm-1.rockspec ├── action.yml ├── flake.nix ├── CHANGELOG.md ├── flake.lock ├── bin └── lua-typecheck-action.lua ├── README.md └── LICENSE /stderr.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /stdout.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.luacheckrc: -------------------------------------------------------------------------------- 1 | ignore = { 2 | "631", -- max_line_length 3 | } 4 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [mrcjkb] 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | -------------------------------------------------------------------------------- /.hadolint.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | ignored: 3 | - DL4006 4 | 5 | # TODO: remove when lua-language-server is available 6 | - DL3007 # Use latest 7 | - DL3018 # Pin versions 8 | -------------------------------------------------------------------------------- /.stylua.toml: -------------------------------------------------------------------------------- 1 | line_endings = "Unix" 2 | indent_type = "Spaces" 3 | indent_width = 2 4 | quote_style = "AutoPreferSingle" 5 | call_parentheses = "NoSingleTable" 6 | collapse_simple_statement = "Never" 7 | -------------------------------------------------------------------------------- /.luarc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", 3 | "Lua.workspace.checkThirdParty": false, 4 | "Lua.runtime.version": "Lua 5.1" 5 | } 6 | -------------------------------------------------------------------------------- /.github/workflows/versioning.yml: -------------------------------------------------------------------------------- 1 | name: Update vX and vX.X tags on release 2 | 3 | on: 4 | release: 5 | types: [published, edited] 6 | 7 | jobs: 8 | actions-tagger: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: Actions-R-Us/actions-tagger@latest 12 | with: 13 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} 14 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing guide 2 | 3 | Contributions are more than welcome! 4 | 5 | ## Changelog 6 | 7 | Please don't forget to add your changes to the "Unreleased" section of [the changelog](./CHANGELOG.md) (if applicable). 8 | 9 | ## Commit messages 10 | 11 | This project uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). 12 | 13 | -------------------------------------------------------------------------------- /.github/workflows/typecheck.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Type Check Code Base 3 | on: 4 | pull_request: ~ 5 | push: 6 | branches: 7 | - master 8 | 9 | jobs: 10 | build: 11 | name: Type Check Code Base 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Checkout Code 16 | uses: actions/checkout@v6 17 | 18 | - name: Type Check Code Base 19 | uses: ./ 20 | with: 21 | configpath: ".luarc.json" 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Lua sources 2 | luac.out 3 | 4 | # luarocks build files 5 | *.src.rock 6 | *.zip 7 | *.tar.gz 8 | 9 | # Object files 10 | *.o 11 | *.os 12 | *.ko 13 | *.obj 14 | *.elf 15 | 16 | # Precompiled Headers 17 | *.gch 18 | *.pch 19 | 20 | # Libraries 21 | *.lib 22 | *.a 23 | *.la 24 | *.lo 25 | *.def 26 | *.exp 27 | 28 | # Shared objects (inc. Windows DLLs) 29 | *.dll 30 | *.so 31 | *.so.* 32 | *.dylib 33 | 34 | # Executables 35 | *.exe 36 | *.out 37 | *.app 38 | *.i*86 39 | *.x86_64 40 | *.hex 41 | 42 | # Nix 43 | result 44 | -------------------------------------------------------------------------------- /lua-typecheck-action-scm-1.rockspec: -------------------------------------------------------------------------------- 1 | local _MODREV, _SPECREV = 'scm', '-1' 2 | rockspec_format = "3.0" 3 | package = 'lua-typecheck-action' 4 | version = _MODREV .. _SPECREV 5 | 6 | description = { 7 | summary = 'A GitHub action that lints your Lua code using sumneko lua-language-server. Static type checking with EmmyLua!', 8 | homepage = 'http://github.com/mrcjkb/lua-typecheck-action', 9 | license = 'GPLv2', 10 | } 11 | 12 | dependencies = { 13 | 'lua >= 5.1', 14 | } 15 | 16 | source = { 17 | url = 'git://github.com/mrcjkb/lua-typecheck-action', 18 | } 19 | 20 | build = { 21 | type = 'builtin', 22 | } 23 | 24 | -------------------------------------------------------------------------------- /.github/workflows/auto-merge.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Dependabot auto-approve 3 | on: pull_request_target 4 | 5 | permissions: 6 | contents: write 7 | pull-requests: write 8 | 9 | jobs: 10 | dependabot: 11 | runs-on: ubuntu-latest 12 | if: ${{ github.actor == 'dependabot[bot]' }} 13 | steps: 14 | - name: Dependabot metadata 15 | id: metadata 16 | uses: dependabot/fetch-metadata@v2 17 | with: 18 | github-token: "${{ secrets.GH_TOKEN_FOR_UPDATES }}" 19 | - name: Approve PR 20 | run: gh pr review --approve "$PR_URL" 21 | env: 22 | PR_URL: ${{github.event.pull_request.html_url}} 23 | GITHUB_TOKEN: ${{ secrets.GH_TOKEN_FOR_UPDATES }} 24 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: 'lua-typecheck-action' 3 | description: 'Type check and lint lua code using lua-language-server.' 4 | author: 'Marc Jakobi' 5 | branding: 6 | color: 'purple' 7 | icon: 'moon' 8 | inputs: 9 | checklevel: 10 | description: "The diagnostics severity level to fail on (Error, Warning, Information or Hint)" 11 | required: true 12 | default: Warning 13 | directories: 14 | description: "The directories to lint (relative to the repository root)." 15 | required: true 16 | default: | 17 | . 18 | configpath: 19 | description: "Path to a luarc.json config file." 20 | required: false 21 | runs: 22 | using: "composite" 23 | steps: 24 | - uses: cachix/install-nix-action@v31 25 | - run: | 26 | nix profile install --quiet --accept-flake-config "${{ github.action_path }}#lua-typecheck-action" 27 | shell: bash 28 | - run: lua-typecheck-action 29 | env: 30 | INPUT_CHECKLEVEL: ${{ inputs.checklevel }} 31 | INPUT_DIRECTORIES: ${{ inputs.directories }} 32 | INPUT_CONFIGPATH: ${{ inputs.configpath }} 33 | shell: bash 34 | -------------------------------------------------------------------------------- /.github/workflows/update.yml: -------------------------------------------------------------------------------- 1 | name: update-flake-lock 2 | on: 3 | workflow_dispatch: # allows manual triggering 4 | schedule: 5 | - cron: '0 0 * * 0' # runs weekly on Sunday at 00:00 6 | 7 | jobs: 8 | lockfile: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout repository 12 | uses: actions/checkout@v6 13 | - name: Install Nix 14 | uses: cachix/install-nix-action@v31 15 | with: 16 | extra_nix_config: | 17 | experimental-features = nix-command flakes 18 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 19 | - name: Update flake.lock 20 | uses: DeterminateSystems/update-flake-lock@v28 21 | with: 22 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} 23 | commit-msg: "deps: update flake.lock" 24 | pr-title: "deps: update flake.lock" 25 | pr-labels: | 26 | dependencies 27 | automated 28 | - uses: reitermarkus/automerge@v2 29 | with: 30 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} 31 | merge-method: squash 32 | pull-request: ${{ github.event.inputs.pull-request }} 33 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "A GitHub action that lints your Lua code using lua-language-server. Static type checking with EmmyLua!"; 3 | 4 | inputs = { 5 | nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 6 | 7 | pre-commit-hooks = { 8 | url = "github:cachix/pre-commit-hooks.nix"; 9 | inputs.nixpkgs.follows = "nixpkgs"; 10 | }; 11 | }; 12 | 13 | outputs = { 14 | self, 15 | nixpkgs, 16 | ... 17 | }: let 18 | supportedSystems = [ 19 | "x86_64-linux" 20 | ]; 21 | perSystem = nixpkgs.lib.genAttrs supportedSystems; 22 | pkgsFor = system: import nixpkgs {inherit system;}; 23 | 24 | lua-typecheck-action-for = system: let 25 | pkgs = pkgsFor system; 26 | lua-typecheck-action-wrapped = pkgs.lua51Packages.buildLuaApplication { 27 | pname = "lua-typecheck-action"; 28 | version = "scm-1"; 29 | 30 | src = self; 31 | }; 32 | in 33 | pkgs.writeShellApplication { 34 | name = "lua-typecheck-action"; 35 | runtimeInputs = with pkgs; [ 36 | lua-language-server 37 | lua-typecheck-action-wrapped 38 | ]; 39 | 40 | text = '' 41 | lua-typecheck-action.lua "$@" 42 | ''; 43 | 44 | checkPhase = ""; 45 | }; 46 | in { 47 | packages = perSystem (system: let 48 | lua-typecheck-action = lua-typecheck-action-for system; 49 | in { 50 | default = lua-typecheck-action; 51 | inherit lua-typecheck-action; 52 | }); 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [1.1.0](https://github.com/mrcjkb/lua-typecheck-action/compare/v1.0.0...v1.1.0) (2025-02-20) 8 | 9 | 10 | ### Features 11 | 12 | * pretty output ([#102](https://github.com/mrcjkb/lua-typecheck-action/issues/102)) ([2c387b0](https://github.com/mrcjkb/lua-typecheck-action/commit/2c387b0398f779147851b92609ee5d189ea9eeee)) 13 | 14 | ## [1.0.0](https://github.com/mrcjkb/lua-typecheck-action/compare/v0.4.0...v1.0.0) (2024-05-31) 15 | 16 | 17 | ### ⚠ BREAKING CHANGES 18 | 19 | * set default directory to project root ([#79](https://github.com/mrcjkb/lua-typecheck-action/issues/79)) 20 | 21 | ### Bug Fixes 22 | 23 | * set default directory to project root ([#79](https://github.com/mrcjkb/lua-typecheck-action/issues/79)) ([903e557](https://github.com/mrcjkb/lua-typecheck-action/commit/903e557390de6135588166f76e719b468076fa27)) 24 | 25 | ## [0.4.0](https://github.com/mrcjkb/lua-typecheck-action/compare/v0.3.0...v0.4.0) (2024-02-05) 26 | 27 | 28 | ### Features 29 | 30 | * suppress nix profile install output ([#52](https://github.com/mrcjkb/lua-typecheck-action/issues/52)) ([e4d2c7c](https://github.com/mrcjkb/lua-typecheck-action/commit/e4d2c7cf0596cd2e2851f6e4089f030beed6167f)) 31 | 32 | ## [0.3.0](https://github.com/mrcjkb/lua-typecheck-action/compare/v0.2.1...v0.3.0) (2024-02-02) 33 | 34 | 35 | ### Features 36 | 37 | * mutable tags and automatic updates ([0fae033](https://github.com/mrcjkb/lua-typecheck-action/commit/0fae0330e20618bc1e2ed5a57e0d1980b3ecbd0a)) 38 | 39 | ## [Unreleased] 40 | 41 | ## [v0.2.0] - 2023-05-04 42 | ### Changed 43 | - Replace docker action with nix composite action 44 | 45 | ## [v0.1.2] - 2023-02-05 46 | ### Changed 47 | - Use nix flake to build and run 48 | 49 | ## [v0.1.1] - 2023-01-19 50 | ### Fixed 51 | - Readme code snippets 52 | 53 | ## [v0.1.0] - 2023-01-19 54 | ### Added 55 | - Initial release 56 | -------------------------------------------------------------------------------- /.github/workflows/release-please.yml: -------------------------------------------------------------------------------- 1 | --- 2 | permissions: 3 | contents: write 4 | pull-requests: write 5 | 6 | name: release-please 7 | on: 8 | workflow_dispatch: 9 | push: 10 | branches: 11 | - master 12 | 13 | jobs: 14 | release-please: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Release 18 | uses: google-github-actions/release-please-action@v4 19 | with: 20 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} 21 | release-type: simple 22 | signoff: "Marc Jakobi" 23 | changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"deps","section":"Dependencies","hidden":false}]' 24 | - uses: actions/checkout@v6 25 | - name: auto-merge 26 | uses: reitermarkus/automerge@v2 27 | with: 28 | package-name: lua-typecheck-action 29 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} 30 | merge-method: squash 31 | pull-request: ${{ github.event.inputs.pull-request }} 32 | - name: Tag major and minor versions 33 | if: ${{ steps.release.outputs.release_created }} 34 | run: | 35 | git config user.name github-actions[bot] 36 | git config user.email 41898282+github-actions[bot]@users.noreply.github.com 37 | git remote add gh-token "https://${{ secrets.GH_TOKEN_FOR_UPDATES }}@github.com/google-github-actions/release-please-action.git" 38 | git tag -d v${{ steps.release.outputs.major }} || true 39 | git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true 40 | git push origin :v${{ steps.release.outputs.major }} || true 41 | git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true 42 | git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}" 43 | git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}" 44 | git push origin v${{ steps.release.outputs.major }} 45 | git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} 46 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-compat": { 4 | "flake": false, 5 | "locked": { 6 | "lastModified": 1761588595, 7 | "narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=", 8 | "owner": "edolstra", 9 | "repo": "flake-compat", 10 | "rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5", 11 | "type": "github" 12 | }, 13 | "original": { 14 | "owner": "edolstra", 15 | "repo": "flake-compat", 16 | "type": "github" 17 | } 18 | }, 19 | "gitignore": { 20 | "inputs": { 21 | "nixpkgs": [ 22 | "pre-commit-hooks", 23 | "nixpkgs" 24 | ] 25 | }, 26 | "locked": { 27 | "lastModified": 1709087332, 28 | "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", 29 | "owner": "hercules-ci", 30 | "repo": "gitignore.nix", 31 | "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", 32 | "type": "github" 33 | }, 34 | "original": { 35 | "owner": "hercules-ci", 36 | "repo": "gitignore.nix", 37 | "type": "github" 38 | } 39 | }, 40 | "nixpkgs": { 41 | "locked": { 42 | "lastModified": 1765457389, 43 | "narHash": "sha256-ddhDtNYvleZeYF7g7TRFSmuQuZh7HCgqstg5YBGwo5s=", 44 | "owner": "nixos", 45 | "repo": "nixpkgs", 46 | "rev": "f997fa0f94fb1ce55bccb97f60d41412ae8fde4c", 47 | "type": "github" 48 | }, 49 | "original": { 50 | "owner": "nixos", 51 | "ref": "nixpkgs-unstable", 52 | "repo": "nixpkgs", 53 | "type": "github" 54 | } 55 | }, 56 | "pre-commit-hooks": { 57 | "inputs": { 58 | "flake-compat": "flake-compat", 59 | "gitignore": "gitignore", 60 | "nixpkgs": [ 61 | "nixpkgs" 62 | ] 63 | }, 64 | "locked": { 65 | "lastModified": 1765464257, 66 | "narHash": "sha256-dixPWKiHzh80PtD0aLuxYNQ0xP+843dfXG/yM3OzaYQ=", 67 | "owner": "cachix", 68 | "repo": "pre-commit-hooks.nix", 69 | "rev": "09e45f2598e1a8499c3594fe11ec2943f34fe509", 70 | "type": "github" 71 | }, 72 | "original": { 73 | "owner": "cachix", 74 | "repo": "pre-commit-hooks.nix", 75 | "type": "github" 76 | } 77 | }, 78 | "root": { 79 | "inputs": { 80 | "nixpkgs": "nixpkgs", 81 | "pre-commit-hooks": "pre-commit-hooks" 82 | } 83 | } 84 | }, 85 | "root": "root", 86 | "version": 7 87 | } 88 | -------------------------------------------------------------------------------- /bin/lua-typecheck-action.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env lua 2 | 3 | ---@class Args 4 | ---@field checklevel string The diagnostics level to fail at 5 | ---@field directories string[] The directories to lint 6 | ---@field configpath string? Path to the luarc.json 7 | 8 | ---@param str string 9 | ---@return string[] list_arg 10 | local function parse_list_args(str) 11 | local tbl = {} 12 | for arg in str:gmatch('[^\r\n]+') do 13 | table.insert(tbl, arg) 14 | end 15 | return tbl 16 | end 17 | 18 | local function getenv_or_err(env_var) 19 | return assert(os.getenv(env_var), env_var .. ' not set.') 20 | end 21 | 22 | local workdir = os.getenv('GITHUB_WORKSPACE') or '.' 23 | 24 | local directory_args = getenv_or_err('INPUT_DIRECTORIES') 25 | local config_path_input = getenv_or_err('INPUT_CONFIGPATH') 26 | local directory_list = parse_list_args(directory_args) 27 | 28 | ---@type Args 29 | local args = { 30 | checklevel = getenv_or_err('INPUT_CHECKLEVEL'), 31 | directories = #directory_list > 0 and directory_list or { '' }, 32 | configpath = (config_path_input ~= '' and '"' .. workdir .. '/' .. config_path_input .. '"' or nil), 33 | } 34 | 35 | ---@param filename string 36 | ---@return string? content 37 | local function read_file(filename) 38 | local content 39 | local f = io.open(filename, 'r') 40 | if f then 41 | content = f:read('*a') 42 | f:close() 43 | end 44 | return content 45 | end 46 | 47 | ---@class LintResult 48 | ---@field success boolean 49 | ---@field directory string 50 | ---@field diagnostics string? 51 | 52 | ---@param directory string 53 | ---@return LintResult 54 | local function lint(directory) 55 | local result = { 56 | directory = directory, 57 | } 58 | local stdout_file = 'stdout.txt' 59 | local stderr_file = 'stderr.txt' 60 | local cmd = 'lua-language-server --check_format=pretty --check ' 61 | .. directory 62 | .. (args.configpath and ' --configpath=' .. args.configpath or '') 63 | .. ' --checklevel=' 64 | .. args.checklevel 65 | local redirect = ' >' .. stdout_file .. ' 2>' .. stderr_file 66 | print(cmd) 67 | local exit_code = os.execute(cmd .. redirect) 68 | local stdout = read_file(stdout_file) or '' 69 | if exit_code ~= 0 then 70 | local stderr = read_file(stderr_file) or '' 71 | result.success = false; 72 | result.diagnostics = stdout .. '\n\n' .. stderr 73 | return result 74 | end 75 | result.success = true 76 | return result 77 | end 78 | 79 | local success = true 80 | for _, directory in ipairs(args.directories) do 81 | local result = lint('"' .. workdir .. '/' .. directory .. '"') 82 | if not result.success then 83 | print('Diagnostics for directory ' .. result.directory .. ':') 84 | print(result.diagnostics) 85 | success = false 86 | end 87 | end 88 | if not success then 89 | error('LINT FAILED!') 90 | end 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lua-language-server type check action 2 | 3 | A GitHub action that lets you leverage [`lua-language-server`](https://github.com/LuaLS/lua-language-server) 4 | and [luaCATS](https://luals.github.io/wiki/annotations/) to statically type check and lint lua code. 5 | 6 | ## Introduction 7 | 8 | What I found the most frustrating about developing Neovim plugins in Lua is the lack 9 | of type safety. 10 | 11 | When I [added](https://github.com/mrcjkb/haskell-tools.nvim/pull/103/files) some LuaCATS 12 | annotations to one of my plugins (to generate Vimdoc using [`lemmy-help`](https://github.com/numToStr/lemmy-help)), 13 | I noticed `lua-language-server` was giving me diagnostics based on my documentation. 14 | This was something I was not getting from linters like `luacheck`. 15 | So I asked myself, "Can I leverage `lua-language-server` and EmmyLua to statically type check my Lua code?" 16 | 17 | The result is this GitHub action, which type checks itself: 18 | 19 | [![Type Check Code Base](https://github.com/mrcjkb/lua-typecheck-action/actions/workflows/typecheck.yml/badge.svg)](https://github.com/mrcjkb/lua-typecheck-action/actions/workflows/typecheck.yml) 20 | 21 | ## Usage 22 | 23 | Create `.github/workflows/typecheck.yml` in your repository with the following contents: 24 | 25 | ```yaml 26 | --- 27 | name: Type Check Code Base 28 | on: 29 | pull_request: ~ 30 | push: 31 | branches: 32 | - master 33 | 34 | jobs: 35 | build: 36 | name: Type Check Code Base 37 | runs-on: ubuntu-latest 38 | 39 | steps: 40 | - name: Checkout Code 41 | uses: actions/checkout@v3 42 | 43 | - name: Type Check Code Base 44 | uses: mrcjkb/lua-typecheck-action@v0 45 | ``` 46 | 47 | ## Inputs 48 | 49 | The following optional inputs can be specified using `with:` 50 | 51 | ### `checklevel` 52 | 53 | The diagnostics severity level to fail on. One of: 54 | 55 | * `Error` 56 | * `Warning` (default) 57 | * `Information` 58 | * `Hint` 59 | 60 | Example: 61 | 62 | ```yaml 63 | - name: Type Check Code Base 64 | uses: mrcjkb/lua-typecheck-action@v0 65 | with: 66 | checklevel: Error 67 | ``` 68 | 69 | ### `directories` 70 | 71 | Directories to lint (relative to the repostitory root). 72 | Defaults to the repository root if none are specified. 73 | 74 | Example: 75 | 76 | ```yaml 77 | - name: Type Check Code Base 78 | uses: mrcjkb/lua-typecheck-action@v0 79 | with: 80 | directories: | 81 | lua 82 | tests 83 | ``` 84 | 85 | ### `configpath` 86 | 87 | Path to a [`.luarc.json`](https://github.com/LuaLS/lua-language-server/wiki/Configuration-File#luarcjson) (relative to the repository root). 88 | 89 | Example: 90 | 91 | ```yaml 92 | - name: Type Check Code Base 93 | uses: mrcjkb/lua-typecheck-action@v0 94 | with: 95 | configpath: ".luarc.json" 96 | ``` 97 | 98 | ## Wiki 99 | 100 | See [the wiki](https://github.com/mrcjkb/lua-typecheck-action/wiki) for usage examples. 101 | 102 | ## Can I use this with a non-GPLv2 licensed project? 103 | 104 | Yes. 105 | Because it is not distributed with any binaries, you can use it in any project. 106 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | --------------------------------------------------------------------------------