name: Validate Conventional Commits

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

jobs:
  validate-commits:
    runs-on: ubuntu-latest
    # Skip validation for Dependabot PRs since they follow their own commit format
    if: github.event.pull_request.user.login != 'dependabot[bot]'

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

      - name: Validate commit messages
        uses: wagoid/commitlint-github-action@v6
        with:
          configFile: .commitlintrc.json
