Skip to content

Commit fed3248

Browse files
authored
chore: Require semantic comments on PR titles. (#9459)
### Description We're looking to use semantic titles for PRs so that they release notes look a little tidier. This action will enforce this for us.
1 parent 85f9b7f commit fed3248

File tree

1 file changed

+33
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)