name: Add "status:waiting for review"-label to new PRs

on:
  pull_request_target:
    types: [opened]

permissions:
  pull-requests: write
  issues: write

jobs:
  new_pr:
    runs-on: ubuntu-latest
    if: github.event_name == 'pull_request_target' && github.event.action == 'opened'
    steps:
      - name: Label new PR as "status:waiting for review"
        uses: actions/github-script@v8
        with:
          script: |
            github.rest.issues.addLabels({
              ...context.repo,
              issue_number: context.payload.pull_request.number,
              labels: ['status:waiting for review']
            })
