name: 'Ping code owners on PRs'
on:
  pull_request_target:
    types: [labeled]

jobs:
  ping-owners:
    runs-on: ubuntu-latest
    if: ${{ github.actor != 'dependabot[bot]' && github.repository_owner == 'open-telemetry' }}
    steps:
      - uses: actions/checkout@v3
    
      - 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 }}