Skip to content

Commit 50ba26c

Browse files
authored
chore: add PR title linter (#181)
- Basic workflow to lint the PR title to enforce conventional commit titles - Copied from lodestar repo - Resolves #172
1 parent 86f430b commit 50ba26c

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: "Lint PR title"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- labeled
10+
- unlabeled
11+
12+
jobs:
13+
main:
14+
name: Validate PR title
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: amannn/action-semantic-pull-request@v5
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
with:
21+
# Configure which types are allowed (newline-delimited).
22+
# Default: https://github.com/commitizen/conventional-commit-types
23+
# Customized based on sections defined in scripts/generate_changelog.mjs
24+
types: |
25+
feat
26+
fix
27+
perf
28+
refactor
29+
revert
30+
deps
31+
build
32+
ci
33+
test
34+
style
35+
chore
36+
docs
37+
38+
# Configure which scopes are allowed (newline-delimited).
39+
# These are regex patterns auto-wrapped in `^ $`.
40+
#scopes: |
41+
42+
# Configure that a scope must always be provided.
43+
requireScope: false
44+
45+
# Configure which scopes are disallowed in PR titles (newline-delimited).
46+
# For instance by setting the value below, `chore(release): ...` (lowercase)
47+
# and `ci(e2e,release): ...` (unknown scope) will be rejected.
48+
# These are regex patterns auto-wrapped in `^ $`.
49+
#disallowScopes: |
50+
51+
# Configure additional validation for the subject based on a regex.
52+
# This example ensures the subject doesn't start with an uppercase character.
53+
subjectPattern: ^(?![A-Z]).+$
54+
55+
# If `subjectPattern` is configured, you can use this property to override
56+
# the default error message that is shown when the pattern doesn't match.
57+
# The variables `subject` and `title` can be used within the message.
58+
subjectPatternError: |
59+
The subject "{subject}" found in the pull request title "{title}"
60+
didn't match the configured pattern. Please ensure that the subject
61+
doesn't start with an uppercase character.
62+
63+
# If the PR contains one of these newline-delimited labels, the
64+
# validation is skipped. If you want to rerun the validation when
65+
# labels change, you might want to use the `labeled` and `unlabeled`
66+
# event triggers in your workflow.
67+
ignoreLabels: |
68+
bot
69+
ignore-semantic-pull-request

0 commit comments

Comments
 (0)