Use sane-fmt to check for TypeScript/JavaScript code formatting.
This will check format of all TypeScript and JavaScript files, excluding .git
and node_modules
.
on: push
jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: sane-fmt/action@master
This will do the same as before but without log grouping and annotations.
on: push
jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: sane-fmt/action@master
with:
actions-logs: 'false'
To check only some files, you must customize args
input.
NOTE: Due to limitation of inputs in GitHub Actions, value of args
must be a YAML string representation of an array, not an actual array.
on: push
jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: sane-fmt/action@master
with:
args: |
- --details=diff
- --color=always
- foo.ts
- bar.ts
- my-directory
You can also choose not to run sane-fmt
immediately, but instead, add it to PATH.
on: push
jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install sane-fmt
uses: sane-fmt/action@master
with:
run: 'false'
export-path: 'true'
- name: Run sane-fmt
run: sane-fmt --details=diff --log-format=github-actions ./
name | description | type | default |
---|---|---|---|
run | Whether sane-fmt should be executed right away | boolean | true |
args | List of CLI arguments to pass to sane-fmt | string[] | [--details=diff, --color=always] |
action-logs | Whether to pass --log-format=github-actions to integrate with GitHub Actions |
boolean | true |
export-path | Whether to add sane-fmt to PATH | boolean | false |
NOTE: total
, changed
, and unchanged
are available only if inputs#run
and inputs#action-logs
are true
.
name | description | type |
---|---|---|
location | Directory where sane-fmt is stored | string |
executable-basename | Base name of sane-fmt (either sane-fmt or sane-fmt.exe ) |
string |
executable-path | Full path to sane-fmt | string |
total | Number of scanned files | number |
changed | Number of scanned files that aren't formatted | number |
unchanged | Number of scanned files that are formatted | number |