name: "Lint PR"

on:
  pull_request_target:
    types:
      - opened
      - edited
      - reopened

jobs:
  lint-pr:
    name: Validate PR title
    runs-on: ubuntu-latest
    permissions:
      pull-requests: read
    steps:
      - uses: amannn/action-semantic-pull-request@v5
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          subjectPattern: ^[a-zA-Z0-9!-_@#=*`.|+,\s]+$
          # If `subjectPattern` is configured, you can use this property to override
          # the default error message that is shown when the pattern doesn't match.
          # The variables `subject` and `title` can be used within the message.
          subjectPatternError: |
            The subject "{subject}" found in the pr title "{title}" didn't match the 
            configured pattern. Can only chars, numbers and symbols !-_@#=*`|+.