---
  name: Conventional Commits

  permissions:
    contents: read

  on:
    pull_request:
      branches:
        - main

  jobs:
    commit-lint:
      name: Verify Conventional Commits

      # Skip this job if this is a release PR
      if: >-
        github.event_name == 'workflow_dispatch' ||
        (github.event_name == 'pull_request' && !startsWith(github.event.pull_request.head.ref, 'release-please--'))

      runs-on: ubuntu-latest

      steps:
        - name: Checkout
          uses: actions/checkout@v4
          with: { fetch-depth: 0 }

        - name: Check Commit Messages
          uses: wagoid/commitlint-github-action@v6
          with: { configFile: .commitlintrc.yml }
