name: Semantic PR title
on:
  pull_request:
    branches: [master]
    types: [opened, edited, synchronize, reopened]
permissions:
  pull-requests: read
  statuses: write

jobs:
  lint-title:
    runs-on: ubuntu-latest
    steps:
      - name: Check PR title against Conventional Commit format
        uses: amannn/action-semantic-pull-request@v5
        with:
          requireScope: false
          # do not start subject with an uppercase letter
          subjectPattern: ^(?![A-Z]).+$
          subjectPatternError: |
            The subject "{subject}" found in the pull request title "{title}" should start with a lowercase letter.
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
