MAF-19232: feat(e2e): use template on e2e tests #243
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 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(' ') | |
| ); | |
| } |