name: Semantic PR title
permissions:
  contents: read
  pull-requests: write

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

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 }}
