name: Changelog check
on: [pull_request_target]

jobs:
  changelog-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version-file: 'internal/tools/go.mod'
      - run: go generate -tags tools internal/tools/tools.go
      - run: go run cmd/changelog-check/main.go ${{ github.event.pull_request.number }}
        working-directory: ./internal/tools
        env:
          GITHUB_OWNER: cloudflare
          GITHUB_REPO: cloudflare-go
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
