name: Lint PR Title

on:
  pull_request:
    types:
      - opened
      - edited
      - synchronize
      - reopened

permissions:
  pull-requests: read
  statuses: write

jobs:
  validate:
    name: Validate Conventional Commits format
    runs-on: ubuntu-latest
    steps:
      - uses: amannn/action-semantic-pull-request@v5
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          types: |
            feat
            fix
            perf
            chore
            docs
            refactor
            test
            ci
            build
            style
          requireScope: false
          subjectPattern: ^[A-Za-z0-9].+$
          subjectPatternError: |
            The PR title subject (after the colon) must start with an alphanumeric character.
            Example: `feat: add CAN bus extraction`
          wip: true
