name: 'Add Labels'
on:
  issue_comment:
    types: [created]

permissions: read-all

jobs:
  add-labels-command:
    if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, '/label') && github.repository_owner == 'open-telemetry' }}
    permissions:
      issues: write

    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - name: Run add-labels-command.sh
        run: ./.github/workflows/scripts/add-labels-command.sh
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ISSUE: ${{ github.event.issue.number }}
          COMMENT: ${{ github.event.comment.body }}
          SENDER: ${{ github.event.sender.login }}
