name: 'Ping code owners on PRs'
on:
  pull_request_target:
    types:
      - labeled
      - ready_for_review

permissions: read-all

jobs:
  ping-owners:
    permissions:
      pull-requests: write
    runs-on: ubuntu-24.04
    if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' && github.repository_owner == 'open-telemetry' && github.event.pull_request.draft == false }}
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - name: Run ping-codeowners-prs.sh
        run: ./.github/workflows/scripts/ping-codeowners-prs.sh
        env:
          REPO: ${{ github.repository }}
          AUTHOR: ${{ github.event.pull_request.user.login }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PR: ${{ github.event.number }}
          COMPONENT: ${{ github.event.label.name }}
