Skip to content

Commit e37499c

Browse files
authored
feat: add action of pr title lint (#2528)
1 parent 19ea453 commit e37499c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/lint-pr.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Lint PR"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions:
11+
pull-requests: read
12+
13+
jobs:
14+
main:
15+
name: Validate PR title
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: amannn/action-semantic-pull-request@v5
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
21+
with:
22+
wip: true
23+
# Configure additional validation for the subject based on a regex.
24+
# This example ensures the subject doesn't start with an uppercase character.
25+
subjectPattern: ^\[\d{19}\].*
26+
# If `subjectPattern` is configured, you can use this property to override
27+
# the default error message that is shown when the pattern doesn't match.
28+
# The variables `subject` and `title` can be used within the message.
29+
subjectPatternError: |
30+
The subject "{subject}" found in the pull request title "{title}"
31+
didn't match the configured pattern. Please ensure that the subject
32+
doesn't start with `[${ticket-id}]`.

0 commit comments

Comments
 (0)