Skip to content

Commit 4df21cb

Browse files
authored
feat: change commit message CI to be PR-based (#983)
With this PR, commit messages will no longer be checked for compliance to conventional commits. However, PR titles *will be checked*.
1 parent 8f3a8e3 commit 4df21cb

File tree

2 files changed

+46
-8
lines changed

2 files changed

+46
-8
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: 'Lint PR'
2+
3+
on:
4+
# This allows the action to be used in a fork-based workflow, where
5+
# e.g. you want to accept pull requests in a public repository.
6+
# In this case, the configuration from the main branch of your repository will be used for the
7+
# check. This means that you need to have this configuration in the main branch for the action to
8+
# run at all (e.g. it won't run within a PR that adds the action initially).
9+
# Also if you change the configuration in a PR, the changes will not be reflected for the current
10+
# PR – only subsequent ones after the changes are in the main branch.
11+
pull_request_target:
12+
types:
13+
- opened
14+
- edited
15+
- reopened
16+
17+
jobs:
18+
main:
19+
name: Validate PR title
20+
runs-on: ubuntu-latest
21+
permissions:
22+
pull-requests: read
23+
steps:
24+
- uses: amannn/action-semantic-pull-request@v6
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
with:
28+
# Configure that a scope is optional
29+
requireScope: false
30+
# Configure additional validation for the subject based on a regex.
31+
# This ensures the subject doesn't start with an uppercase character.
32+
subjectPattern: ^(?![A-Z]).+$
33+
# If `subjectPattern` is configured, you can use this property to override
34+
# the default error message that is shown when the pattern doesn't match.
35+
# The variables `subject` and `title` can be used within the message.
36+
subjectPatternError: |
37+
The subject "{subject}" found in the pull request title "{title}"
38+
didn't match the configured pattern. Please ensure that the subject
39+
doesn't start with an uppercase character.
40+
# If the PR contains one of these newline-delimited labels, the
41+
# validation is skipped. If you want to rerun the validation when
42+
# labels change, you might want to use the `labeled` and `unlabeled`
43+
# event triggers in your workflow.
44+
ignoreLabels: |
45+
bot
46+
ignore-semantic-pull-request

.pre-commit-config.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,3 @@ repos:
139139
hooks:
140140
- id: reuse-lint-file
141141
exclude: COMMIT_EDITMSG|MERGE_MSG
142-
143-
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
144-
rev: v9.22.0
145-
hooks:
146-
- id: commitlint
147-
stages: [commit-msg]
148-
additional_dependencies:
149-
- "@commitlint/config-conventional"

0 commit comments

Comments
 (0)