name: Conventional Commit Check

on:
  pull_request:
  push:
    branches:
      - main

jobs:
  conventional_commits:
    name: Conventional Commit Check
    runs-on: ubuntu-latest
    steps:        
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: install convco
        uses: taiki-e/cache-cargo-install-action@v2
        with:
          tool: convco
      - name: Check commit format
        if: github.event_name == 'pull_request'
        run: convco check "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"

