Skip to content

Commit fc4ab90

Browse files
authored
ci: add PR title validation workflow (#25)
- Add semantic pull request validation using amannn/action-semantic-pull-request - Configure validation to run on pull_request_target opened, edited, and synchronize events - Set up permissions for contents read, pull-requests read, and statuses write - Apply validation only to antdv-next/cli repository - Use ubuntu-slim runner for validation job - Enforce subject pattern to prevent uppercase first letter in PR titles - Provide custom error message for subject pattern violations - Configure GITHUB_TOKEN environment variable for authentication
1 parent 2e43630 commit fc4ab90

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Validate PR title
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions: {}
11+
12+
jobs:
13+
semantic-pr:
14+
permissions:
15+
contents: read
16+
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
17+
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
18+
if: github.repository == 'antdv-next/cli'
19+
runs-on: ubuntu-slim
20+
name: 🏷️ Validate PR title
21+
steps:
22+
- name: Validate PR title
23+
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
24+
with:
25+
subjectPattern: ^(?![A-Z]).+$
26+
subjectPatternError: |
27+
The subject "{subject}" found in the pull request title "{title}"
28+
didn't match the configured pattern. Please ensure that the subject
29+
doesn't start with an uppercase character.
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)