1
0
Fork 0
mirror of https://github.com/JohnnyMorganz/stylua-action.git synced 2025-10-16 16:38:22 -05:00
Forgejo action for StyLua
Find a file
Colin Kennedy 479972f01e
Allow running stylua as an optional step (#58)
* feat(run): `args: false` will install+cache but not run

* Extend smoketest to show stylua can be run

* Tweak readme slightly

* Commit compiled output

---------

Co-authored-by: JohnnyMorganz <johnnymorganz@outlook.com>
2025-04-01 14:15:02 +02:00
.github/workflows Allow running stylua as an optional step (#58) 2025-04-01 14:15:02 +02:00
dist Allow running stylua as an optional step (#58) 2025-04-01 14:15:02 +02:00
src Allow running stylua as an optional step (#58) 2025-04-01 14:15:02 +02:00
test Allow running stylua as an optional step (#58) 2025-04-01 14:15:02 +02:00
.eslintignore Initial commit 2021-05-11 20:14:04 +01:00
.eslintrc.json Allow specifying semver version ranges for stylua version (#49) 2023-04-29 21:54:57 +01:00
.gitattributes lf endings 2022-10-29 15:05:13 +01:00
.gitignore Initial commit 2021-05-11 20:14:04 +01:00
.prettierignore Initial commit 2021-05-11 20:14:04 +01:00
.prettierrc.json Initial commit 2021-05-11 20:14:04 +01:00
action.yml Upgrade Node.js to v20 2024-02-08 10:09:24 +01:00
jest.config.js Update packages 2022-09-21 20:55:14 +01:00
LICENSE Fix licence + remove workflow 2021-07-12 19:44:42 +01:00
package-lock.json Upgrade Node.js to v20 2024-02-08 10:09:24 +01:00
package.json Upgrade Node.js to v20 2024-02-08 10:09:24 +01:00
README.md Allow running stylua as an optional step (#58) 2025-04-01 14:15:02 +02:00
tsconfig.json Update packages 2022-09-21 20:55:14 +01:00

StyLua GitHub Action stylua-action status

GitHub Action to run StyLua, a Lua code formatter.

Installs the StyLua binary (from GitHub releases), and caches it. Any StyLua command can then be run.

NOTE: We recommend using a toolchain manager such as aftman to manage StyLua, as it allows you to define the version used throughout your project - both on the command line, and in GitHub actions.

Usage

- uses: actions/checkout@v4
- uses: JohnnyMorganz/stylua-action@v4
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    version: latest # NOTE: we recommend pinning to a specific version in case of formatting changes
    # CLI arguments
    args: --check .

If you would just like to install stylua, but not run it (e.g., since it is used as part of a wider CI script), then you can set args: false:

- uses: actions/checkout@v4
- uses: JohnnyMorganz/stylua-action@v4
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    version: latest # NOTE: we recommend pinning to a specific version in case of formatting changes
    # This disables running `stylua`
    args: false
  # Run stylua independently
- run: |
    stylua --version

Parameters

token (Required)

GitHub token. Required since the binary is downloaded from GitHub releases (to speed download)

args (Required)

The arguments to pass to the StyLua binary. If you don't want to run the binary, set args: false.

version (Required)

The version of StyLua to use. Follows semver syntax. Alternatively, supply latest to use the latest available release.

NOTE: using latest may cause the action to fail if StyLua updates and the formatting changes!

Based off https://github.com/Roblox/setup-foreman, licensed under MIT