name: Check Formatting and Committers

on:
  pull_request:
    branches: [ main ]

jobs:
  verify:
    name: Verify format and committers
    runs-on: ubuntu-18.04
    steps:
      - name: Setup Go 1.x
        uses: actions/setup-go@v2
        with:
          go-version: ^1.18
      - uses: actions/checkout@v2
      - name: Check all
        working-directory: ./go
        # Keep this in sync with //go/utils/prepr/prepr.sh.
        run: |
          GOFLAGS="-mod=readonly" go build ./...
          go vet -mod=readonly ./...
          go run -mod=readonly ./utils/copyrightshdrs/
          ./utils/repofmt/check_fmt.sh
          ./Godeps/verify.sh
          ./utils/repofmt/check_bats_fmt.sh
        env:
          BRANCH_NAME: ${{ github.head_ref }}
          CHANGE_TARGET: ${{ github.base_ref }}
