Skip to content

Commit 223fb0b

Browse files
authored
ci: add action to lint PR title (#69)
1 parent e4c706f commit 223fb0b

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: "Lint Pull Request Titles"
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+
id: lint_pr_title
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
with:
23+
# Configure which types are allowed (newline-delimited).
24+
# ref: biomejs/biome/CONTRIBUTING.md
25+
types: |
26+
build
27+
chore
28+
ci
29+
docs
30+
feat
31+
fix
32+
perf
33+
refactor
34+
release
35+
revert
36+
test
37+
# Configure that a scope must always be provided.
38+
requireScope: false
39+
# Configure which scopes are disallowed in PR titles.
40+
# These are regex patterns auto-wrapped in `^ $`.
41+
#
42+
# We disable the following scopes:
43+
# - `release` because we have the `release` type
44+
# - UPPERCASE titles because we promote the use of lowercase
45+
disallowScopes: |
46+
[A-Z]+
47+
# Configure additional validation for the subject based on a regex.
48+
# Ensures that the subject doesn't start with an uppercase character.
49+
subjectPattern: ^[^A-Z].*$
50+
# If `subjectPattern` is configured, you can use this property to override
51+
# the default error message that is shown when the pattern doesn't match.
52+
# The variables `subject` and `title` can be used within the message.
53+
subjectPatternError: |
54+
The subject "{subject}" found in the pull request title "{title}"
55+
didn't match the configured pattern.
56+
Please ensure that the subject doesn't start with an uppercase character.
57+
The scope should not be in UPPERCASE.

0 commit comments

Comments
 (0)