|
| 1 | +name: lua-style |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: [ develop, release, test ] |
| 7 | + #pull_request: |
| 8 | + # branches: [ develop, release, test ] |
| 9 | + |
| 10 | +# minimal perms to allow auto-commit on push |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + lua-style: |
| 16 | + name: style linters |
| 17 | + if: ${{ github.actor != 'dependabot[bot]' }} |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Check out Git repository |
| 21 | + uses: actions/checkout@v5 |
| 22 | + with: |
| 23 | + # lets auto-commit push back to the same branch |
| 24 | + ref: ${{ github.head_ref }} |
| 25 | + |
| 26 | + # Formatting (StyLua) |
| 27 | + # check-only on PRs |
| 28 | + - name: StyLua (check) |
| 29 | + if: ${{ github.event_name == 'pull_request' }} |
| 30 | + uses: JohnnyMorganz/stylua-action@v4 |
| 31 | + with: |
| 32 | + token: ${{ secrets.IKEMEN_TOKEN }} |
| 33 | + version: v2.3.1 |
| 34 | + args: --config-path .github/.stylua.toml --check . |
| 35 | + |
| 36 | + # write fixes on branch pushes |
| 37 | + - name: StyLua (write) |
| 38 | + if: ${{ github.event_name != 'pull_request' }} |
| 39 | + uses: JohnnyMorganz/stylua-action@v4 |
| 40 | + with: |
| 41 | + token: ${{ secrets.IKEMEN_TOKEN }} |
| 42 | + version: v2.3.1 |
| 43 | + args: --config-path .github/.stylua.toml . |
| 44 | + |
| 45 | + # Linting (Luacheck) |
| 46 | + - name: Luacheck |
| 47 | + uses: lunarmodules/luacheck@v1 |
| 48 | + continue-on-error: true |
| 49 | + with: |
| 50 | + # pass extra args if you have a .luacheckrc |
| 51 | + args: . --no-color --ignore 111 --ignore 112 --ignore 113 --ignore 142 --ignore 143 |
| 52 | + |
| 53 | + # Commit format changes on push |
| 54 | + - name: Commit formatting changes |
| 55 | + if: ${{ github.event_name != 'pull_request' }} |
| 56 | + uses: stefanzweifel/git-auto-commit-action@v5 |
| 57 | + with: |
| 58 | + commit_message: "style(lua): fix code style issues with StyLua" |
| 59 | + commit_user_name: lint-action |
| 60 | + commit_user_email: 59283862+lint-action@users.noreply.github.com |
| 61 | + commit_author: "lint-action <59283862+lint-action@users.noreply.github.com>" |
| 62 | + file_pattern: "**/*.lua" |
0 commit comments