name: "Conventional commit message checker"
on:
  pull_request:
    types:
      - opened
      - edited
      - reopened
      - synchronize

jobs:
  check-commit-message:
    name: Validate Commit Message
    runs-on: ubuntu-latest
    steps:
      - name: Check Commit Type
        uses: gsactions/commit-message-checker@v2
        with:
          pattern: '^(|feat|fix|chore|docs|style|ci|refactor|perf|test|build)(\([\w-]+\))?:\s.+$|^(Merge\sbranch)|^(Merge\sremote)'
          error: 'Your first line has to contain a commit type like "feat|fix|chore|docs|style|ci|refactor|perf|test".'
          excludeDescription: "true"
          excludeTitle: "true"
          checkAllCommitMessages: "true"
          accessToken: ${{ secrets.GITHUB_TOKEN }}
