fix: use consolidated event tool for planned-event descriptions #8280
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 Conventional Commit Validation | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, edited] | |
| jobs: | |
| validate-pr-title: | |
| name: validate-pr-title | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| steps: | |
| - name: Validate PR title | |
| uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7 | |
| with: | |
| script: | | |
| const title = context.payload.pull_request.title; | |
| const types = ['feat', 'fix', 'docs', 'test', 'ci', 'refactor', 'perf', 'chore', 'revert']; | |
| const conventionalCommitRegex = /^(feat|fix|docs|test|ci|refactor|perf|chore|revert)(\([^)]+\))?!?:\s*.+/; | |
| if (!conventionalCommitRegex.test(title)) { | |
| core.setFailed( | |
| `Pull request title is not a valid conventional commit. Allowed types: ${types.join(', ')}.\n` + | |
| `Title must be lowercase and match pattern: type(scope)?: description or type(scope)!: description` | |
| ); | |
| return; | |
| } | |
| core.info('PR title is a valid conventional commit'); |