Skip to content

MAF-19232: feat(e2e): use template on e2e tests #243

MAF-19232: feat(e2e): use template on e2e tests

MAF-19232: feat(e2e): use template on e2e tests #243

name: PR Title Checker
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
on:
pull_request:
branches:
- main
types:
- opened
- edited
- reopened
- synchronize
- ready_for_review
workflow_dispatch:
jobs:
pr-title-check:
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Ensure PR title follows Conventional Commit format
uses: actions/github-script@v7
with:
script: |
const title = context.payload.pull_request?.title ?? '';
const pattern = /^(([A-Z]+-[0-9]+|NO-ISSUE): )?(feat|fix|refactor|style|test|docs|chore)(\([a-z0-9_\/-]+\))?(!)?: .+/;
if (!pattern.test(title)) {
core.setFailed(
[
`PR title "${title}" does not match the expected pattern.`,
'Use Conventional Commits, optionally prefixed with a JIRA ID or "NO-ISSUE" (e.g. "MAF-1234: feat(filter): add new filter" or "NO-ISSUE: chore: cleanup").',
'Allowed types: feat, fix, refactor, style, test, docs, chore.',
'Optional scope may include lowercase letters, digits, "/", or "-".',
'Add "!" before the colon for breaking changes.'
].join(' ')
);
}