diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..62f3a4c --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,36 @@ +name: format + +on: + push: + branches: + - master + +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: '^1.19' + + - name: Format with gofmt + run: go fmt . + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "style(format): run gofmt" + + - name: Install goimports + run: go install golang.org/x/tools/cmd/goimports@latest + + - name: Format with goimports + run: goimports -w . + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "style(format): run goimports"