diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 8908e21..7cad830 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -12,7 +12,7 @@ jobs: lint: permissions: contents: read # for actions/checkout to fetch code - pull-requests: read # for golangci/golangci-lint-action to fetch pull requests + pull-requests: write # for betteralign to comment on PR checks: write # for golangci/golangci-lint-action to annotate Pull Requests name: Lint Go code runs-on: ubuntu-latest @@ -27,6 +27,23 @@ jobs: version: v1.54 args: --timeout 10m --exclude SA5011 --verbose --issues-exit-code=0 only-new-issues: true + - name: Run betteralign + id: betteralign + run: | + go install github.com/dkorunic/betteralign/cmd/betteralign@latest + betteralign ./... >> $BETTERALIGN_OUTPUT + - uses: actions/github-script@v7 + with: + script: | + const output = `#### Betteralign 🤖\`${{ steps.betteralign.outputs.BETTERALIGN_OUTPUT }}\` + *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) test: name: Run unit tests for Go packages