From 5bb8947309eeb3b677c5a3eecc920fdfe6addd6e Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Thu, 17 Feb 2022 12:12:03 -0800 Subject: [PATCH] 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 --- .github/workflows/reviewdog.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/reviewdog.yml diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml new file mode 100644 index 000000000..a64aaaad9 --- /dev/null +++ b/.github/workflows/reviewdog.yml @@ -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