name: 🆙 Release file check

on:
  pull_request_target:
    types: [synchronize, reopened, opened, ready_for_review]
    branches:
      - main
    paths:
      - "strawberry/**"
      - "pyproject.toml"

jobs:
  check-release:
    name: Release check
    runs-on: ubuntu-latest
    environment: release
    if: github.event.pull_request.user.type != 'Bot'

    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
        with:
          ref: "refs/pull/${{ github.event.number }}/merge"
          sparse-checkout: |
            RELEASE.md
            pyproject.toml
          sparse-checkout-cone-mode: false

      - name: Check for release
        id: check
        uses: autopub/autopub-action@5fdc82e84c048a82303de6b5c5a9d027665e73cf # v1.1.1
        with:
          command: check
          autopub-version: "1.0.0a58"
          github-token: ${{ secrets.BOT_TOKEN }}
          fail-on-missing: "true"
          extra-plugins: strawberry-autopub-plugins
