name: Triage

on:
  issues:
    types:
      - opened

  pull_request_target:
    types:
      - opened

jobs:
  triage:
    runs-on: ubuntu-latest
    name: Label

    steps:
      - name: Label pull requests
        uses: actions/labeler@v3
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"
          configuration-path: .github/pr_labeler_new.yml
        if: github.event_name == 'pull_request_target'

      - name: Label issues
        uses: github/issue-labeler@v2.4.1
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"
          not-before: 2021-12-07T07:00:00Z
          configuration-path: .github/issue_labeler.yml
          enable-versioned-regex: 0
        if: github.event_name == 'issues'
