name: PR Template Check

on:
    pull_request:
        types:
            - opened
            - edited
            - reopened
            - synchronize

permissions:
    contents: read

jobs:
    pr-template-check:
        name: Validate PR template
        if: github.event.pull_request.user.type != 'Bot'
        runs-on: ubuntu-latest
        steps:
            - name: Check out base branch workflow files
              uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
              with:
                  ref: ${{ github.event.pull_request.base.sha }}
                  persist-credentials: false

            - name: Validate PR body structure and linkage
              env:
                  PR_BODY: ${{ github.event.pull_request.body || '' }}
              run: node apps/desktop/scripts/ci/pr-template-check.js
