# Label PRs based on their titles.
#
# Uses conventional commit types from PR titles to apply labels.
# Note: Scope-based labeling (e.g., integration labels) is handled by pr_labeler_file.yml

name: "🏷️ PR Title Labeler"

on:
  # Safe since we're not checking out or running the PR's code
  # Never check out the PR's head in a pull_request_target job
  pull_request_target:
    types: [opened, edited]

permissions:
  contents: read

jobs:
  pr-title-labeler:
    name: "label"
    permissions:
      contents: read
      pull-requests: write
      issues: write
    runs-on: ubuntu-latest

    steps:
      - name: Label PR based on title
        uses: bcoe/conventional-release-labels@b503ca473654e07521c051628c5f1f969e7436da # v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          type_labels: >-
            {
              "feat": "feature",
              "fix": "fix",
              "docs": "documentation",
              "style": "linting",
              "refactor": "refactor",
              "perf": "performance",
              "test": "tests",
              "build": "infra",
              "ci": "infra",
              "chore": "infra",
              "revert": "revert",
              "release": "release",
              "breaking": "breaking"
            }
          ignored_types: '[]'
