Skip to content

Commit f06699c

Browse files
kayman-mknpalm
andauthored
ci: validate PR title (#625)
* ci: validate PR title * use default github_token * Update .github/workflows/lint_pr_title.yml Co-authored-by: Niek Palm <[email protected]> Co-authored-by: Niek Palm <[email protected]>
1 parent 9056fb2 commit f06699c

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/lint_pr_title.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "Lint PR title"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
branches-ignore:
10+
- 'release-please--branches--*'
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+
# Default: https://github.com/commitizen/conventional-commit-types
22+
types: |
23+
build
24+
chore
25+
ci
26+
docs
27+
feat
28+
fix
29+
perf
30+
refactor
31+
revert
32+
style
33+
test
34+
# Configure which scopes are allowed.
35+
# deps - dependency updates
36+
# main - for release-please (scope used for releases)
37+
scopes: |
38+
deps
39+
main
40+
# Configure that a scope must always be provided.
41+
requireScope: false
42+
# Configure additional validation for the subject based on a regex.
43+
# This example ensures the subject doesn't start with an uppercase character.
44+
subjectPattern: ^(?![A-Z]).+$
45+
# If `subjectPattern` is configured, you can use this property to override
46+
# the default error message that is shown when the pattern doesn't match.
47+
# The variables `subject` and `title` can be used within the message.
48+
subjectPatternError: |
49+
The subject "{subject}" found in the pull request title "{title}"
50+
didn't match the configured pattern. Please ensure that the subject
51+
doesn't start with an uppercase character.
52+
# For work-in-progress PRs you can typically use draft pull requests
53+
# from GitHub. However, private repositories on the free plan don't have
54+
# this option and therefore this action allows you to opt-in to using the
55+
# special "[WIP]" prefix to indicate this state. This will avoid the
56+
# validation of the PR title and the pull request checks remain pending.
57+
# Note that a second check will be reported if this is enabled.
58+
wip: true
59+
# When using "Squash and merge" on a PR with only one commit, GitHub
60+
# will suggest using that commit message instead of the PR title for the
61+
# merge commit, and it's easy to commit this by mistake. Enable this option
62+
# to also validate the commit message for one commit PRs.
63+
validateSingleCommit: true
64+
# Related to `validateSingleCommit` you can opt-in to validate that the PR
65+
# title matches a single commit to avoid confusion.
66+
validateSingleCommitMatchesPrTitle: false

0 commit comments

Comments
 (0)