name: conventional commits

on:
  pull_request:
    types: [opened, edited, synchronize, reopened]

permissions:
  pull-requests: read

jobs:
  lint-pr-title:
    name: PR title is Conventional Commit
    runs-on: ubuntu-latest
    steps:
      - uses: amannn/action-semantic-pull-request@v5
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          types: |
            feat
            fix
            perf
            refactor
            docs
            test
            build
            ci
            chore
            style
          requireScope: false
          subjectPattern: ^(?![A-Z]).+$
          subjectPatternError: |
            The PR subject must start with a lowercase letter, e.g.
              feat: add foo
            not
              feat: Add foo