Add Reviewdog to suggestion gofmt and whitespace changes in pull request (#5155)

use reviewdog to automatically suggest whitespace corrections in PRs
so that code will be clean before committing into master branch.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang
2022-02-17 12:12:03 -08:00
committed by GitHub
parent 35e2070009
commit 5bb8947309

23
.github/workflows/reviewdog.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: Reviewdog
on:
pull_request:
branches:
- master
jobs:
gofmt:
name: Go Fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: find . -not -path '*/\.git/*' -type f -name '*.go' -exec gofmt -s -w {} \+
- uses: reviewdog/action-suggester@v1
whitespace:
name: Whitespace
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: find . -not -path '*/\.git/*' -type f -not -name '*.go' -exec sed -i 's/[[:space:]]\{1,\}$//' {} \+
- uses: reviewdog/action-suggester@v1