name: PR title check

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

concurrency:
  group: ${{ github.workflow }}-${{ github.event.number }}
  cancel-in-progress: true

jobs:
  pr-title-lint:
    name: Should follow conventional commit spec
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npm i @actions/core @actions/github
      - run: node .github/actions/pr-titles.mjs
