name: Pull Request Regex Title Labeler
on:
  pull_request_target:
    types: [opened, edited]

# Restrict the permissions granted to the use of secrets.GITHUB_TOKEN in this
# github actions workflow:
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication
permissions:
  contents: read
  pull-requests: write

jobs:

  labeler:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-python@v5
      with:
        python-version: '3.9'
    - name: Install PyGithub
      run: pip install -Uq PyGithub
    - name: Label pull request
      run: python .github/scripts/label_title_regex.py
      env:
        CONTEXT_GITHUB: ${{ toJson(github) }}
