# Copyright 2025 The go-yaml Project Contributors
# SPDX-License-Identifier: Apache-2.0

name: Commit Message Check

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

permissions: read-all

jobs:
  check-commit-message:
    name: Check Commit Message
    runs-on: ubuntu-latest
    if: github.event.pull_request.user.login != 'dependabot[bot]'

    steps:
    - name: Checkout code
      uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10  # v6.0.3
      with:
        fetch-depth: 0  # Fetch all history to ensure all SHAs are available
        persist-credentials: false

    - name: Check PR Commits
      run:
        util/check-commit-messages
        ${{ github.event.pull_request.base.sha }}..${{
            github.event.pull_request.head.sha }}
