👷 ci: add PR quality gates, commit message enforcement, and QA ICU fix #29
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Readiness Checklist | |
| on: | |
| pull_request: | |
| types: [ opened, edited, reopened, synchronize, ready_for_review, labeled, unlabeled ] | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| readiness-checklist: | |
| name: Validate mandatory PR checklist | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.draft == false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Validate checklist | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { validatePrChecklist } = require('./.github/scripts/pr-readiness-check.js'); | |
| const pr = context.payload.pull_request; | |
| const labels = (pr.labels || []).map((l) => l.name); | |
| if (labels.includes('checklist-exception')) { | |
| core.notice('Bypassing checklist — PR has label: checklist-exception'); | |
| return; | |
| } | |
| const files = await github.paginate(github.rest.pulls.listFiles, { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: pr.number, | |
| per_page: 100, | |
| }); | |
| const migrationFilenames = files | |
| .map((f) => f.filename) | |
| .filter((name) => name.startsWith('migrations/') && name !== 'migrations/AbstractMatecatMigration.php'); | |
| const testFilesWithAdditions = files | |
| .filter((f) => f.filename.startsWith('tests/') && f.additions > 0) | |
| .map((f) => f.filename); | |
| const errors = validatePrChecklist(pr.body || '', { migrationFilenames, testFilesWithAdditions }); | |
| if (errors.length > 0) { | |
| core.setFailed( | |
| [ | |
| 'PR readiness checklist incomplete:', | |
| '', | |
| ...errors, | |
| '', | |
| 'Update the PR body checklist. To bypass, apply label: checklist-exception', | |
| ].join('\n'), | |
| ); | |
| } | |
| readiness-tests: | |
| name: PR checklist script tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| - name: Run tests | |
| run: node --test .github/scripts/pr-readiness-check.test.js |