name: PR Conventional Commit Validation

on:
  pull_request_target:
    types: [opened, synchronize, reopened, edited, labeled]

jobs:
  validate-pr-title:
    if: ${{ contains(github.event.pull_request.labels.*.name, 'safe to test') || !github.event.pull_request.head.repo.fork }} 
    permissions:
       pull-requests: write
    runs-on: ubuntu-latest
    steps:
      - name: PR Conventional Commit Validation
        uses:  ytanikin/PRConventionalCommits@b628c5a234cc32513014b7bfdd1e47b532124d98
        with:
          task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert"]'
          custom_labels: '{"feat": "feature", "fix": "fix", "docs": "documentation", "test": "test", "ci": "CI/CD", "refactor": "refactor", "perf": "performance", "chore": "chore", "revert": "revert", "wip": "WIP"}'
