From 4146a830b567d4b3bd9b2c4eccd4673ff3e204a2 Mon Sep 17 00:00:00 2001 From: wfjsw Date: Sat, 13 Feb 2021 01:27:17 +0800 Subject: [PATCH] ci: add goimports auto style fix --- .github/workflows/goimports.yml | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/goimports.yml diff --git a/.github/workflows/goimports.yml b/.github/workflows/goimports.yml new file mode 100644 index 00000000..e8c0e33b --- /dev/null +++ b/.github/workflows/goimports.yml @@ -0,0 +1,41 @@ +name: Goimports Style Fix + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + types: [ opened, synchronize ] + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.13 + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Fix stylings + run: | + export PATH="$PATH:$GOPATH/bin" + GO111MODULE=off go get golang.org/x/tools/cmd/goimports + goimports -l -w ./ + + - name: Commit back + continue-on-error: true + run: | + git config --local user.name 'github-actions' + git config --local user.email 'github-actions@users.noreply.github.com' + git add --all + git commit -m "ci(chore): Fix stylings" + git push + +# - name: Test +# run: go test -v .