2022-11-09 14:43:49 +01:00
|
|
|
# GitHub Action: Run Clippy with reviewdog
|
|
|
|
|
|
|
|
This action runs [Clippy](https://github.com/rust-lang/rust-clippy) with
|
|
|
|
[reviewdog](https://github.com/reviewdog/reviewdog) on pull requests to improve code review experience.
|
|
|
|
|
2022-11-10 00:41:42 +01:00
|
|
|
<img width="943" alt="スクリーンショット 2022-11-08 8 57 47" src="https://user-images.githubusercontent.com/17407489/200965354-b79c2b86-958f-42ca-bdf1-46bf5511aa5e.png">
|
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
## Example usage
|
|
|
|
|
|
|
|
```yml
|
|
|
|
name: clippy-action
|
|
|
|
on: [pull_request]
|
|
|
|
jobs:
|
|
|
|
clippy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-11-10 14:27:08 +01:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2022-11-15 14:34:27 +01:00
|
|
|
with:
|
|
|
|
components: clippy
|
2022-11-17 14:17:57 +01:00
|
|
|
- uses: giraffate/clippy-action@v1
|
2022-11-09 14:43:49 +01:00
|
|
|
with:
|
|
|
|
reporter: 'github-pr-review'
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2022-11-01 06:58:59 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
## Inputs
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
### `github_token`
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
**Required**. Default is `${{ github.token }}`.
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
### `clippy_flags`
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
Optional. clippy flags. (cargo clippy --color never -q --message-format json `<clippy_flags>`)
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
### `tool_name`
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
Optional. Tool name to use for reviewdog reporter. Useful when running multiple actions with different config.
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
### `level`
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
Optional. Report level for reviewdog [info,warning,error].
|
|
|
|
It's same as `-level` flag of reviewdog.
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
### `workdir`
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
Optional. Working directory relative to the root directory.
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
### `reporter`
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
Optional. Reporter of reviewdog command [github-pr-check,github-pr-review].
|
|
|
|
It's same as `-reporter` flag of reviewdog.
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
### `filter_mode`
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
Optional. Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
|
|
|
|
Default is added.
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
### `fail_on_error`
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
Optional. Exit code for reviewdog when errors are found [`true`, `false`]
|
|
|
|
Default is `false`.
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
### `reviewdog_flags`
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
Optional. Additional reviewdog flags
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
### `reviewdog_version`
|
2022-11-01 06:58:59 +01:00
|
|
|
|
2022-11-09 14:43:49 +01:00
|
|
|
Optional. Install a specific version of reviewdog.
|
|
|
|
By default, the latest version of reviewdog is installed.
|