summaryrefslogtreecommitdiff
path: root/.github/workflows/format.yaml
blob: 576b9a5eee3a846f66844763c1b2b60abe583c10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: format

on:
  pull_request:
    branches:
      - "master"
    paths:
      - 'lua/**'
      - 'snapshots/**'
      - 'tests/**'
      - 'utils/**'

jobs:
  stylua-check:
    name: "Formatting check with Stylua"
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3

      - name: Lint with stylua
        uses: JohnnyMorganz/stylua-action@v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          # CLI arguments
          version: 0.15.3
          args: --check .

  shfmt-check:
    name: "Formatting check with shfmt"
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3

      - name: Setup Go
        uses: actions/setup-go@v3
        with:
          go-version: "1.18"

      - name: Use shfmt
        run: |
          go install mvdan.cc/sh/v3/cmd/[email protected]

      # https://google.github.io/styleguide/shellguide.html
      - name: Check formatting
        run: make style-sh