generated from hms-networks/sc-java-maven-starter-project
-
Notifications
You must be signed in to change notification settings - Fork 3
64 lines (58 loc) · 3.91 KB
/
commit-format-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# HMS Networks; Americas
# Commit Format Action for Maven-based Ewon ETK Projects
# Version: 3.0.0
# Date: February 8, 2024
#
# This action is configured to automatically run when a push
# is made to a pull request for the `main` branch.
name: Commit Format Check
on:
pull_request:
branches:
- main
jobs:
commit-format-check:
name: Check Commit Message
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- name: Check Title Line Length
uses: gsactions/commit-message-checker@v2
with:
pattern: '^.{0,50}((\r|\n|\r\n)(.*|\r|\n|\r\n)*)?$' # matches if first line (title) less than 50 characters in length, followed by 0 or more additional lines
flags: 'y' # y flag indicates "sticky" search that matches starting at beginning (or current location) of string.
error: 'The maximum title line length of 50 characters is exceeded.'
excludeDescription: 'true' # optional: this excludes the description body of a pull request
excludeTitle: 'true' # optional: this excludes the title of a pull request
checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true
- name: Check Title Does Not End With Period
uses: gsactions/commit-message-checker@v2
with:
pattern: '^.*[^.\r\n]((\r|\n|\r\n)(.*|\r|\n|\r\n)*)?$' # matches if first line (title) does not end with period, followed by 0 or more additional lines
flags: 'y' # y flag indicates "sticky" search that matches starting at beginning (or current location) of string.
error: 'The title must not end with a period.'
excludeDescription: 'true' # optional: this excludes the description body of a pull request
excludeTitle: 'true' # optional: this excludes the title of a pull request
checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true
- name: Check Title Begins With Capital
uses: gsactions/commit-message-checker@v2
with:
pattern: '^[A-Z0-9].*((\r|\n|\r\n)(.*|\r|\n|\r\n)*)?$' # matches if first line (title) begins with capital letter or number, followed by 0 or more additional lines
flags: 'y' # y flag indicates "sticky" search that matches starting at beginning (or current location) of string.
error: 'The title must begin with a capitalized first character (or number).'
excludeDescription: 'true' # optional: this excludes the description body of a pull request
excludeTitle: 'true' # optional: this excludes the title of a pull request
checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true
- name: Check Body Line Length
uses: gsactions/commit-message-checker@v2
with:
pattern: '^(.{0,72}(\r|\n|\r\n))*.{0,72}?$' # matches if 0 or more lines are less than or equal to 72 characters in length
flags: 'y' # y flag indicates "sticky" search that matches starting at beginning (or current location) of string.
error: 'The maximum body line length of 72 characters is exceeded.'
excludeDescription: 'true' # optional: this excludes the description body of a pull request
excludeTitle: 'true' # optional: this excludes the title of a pull request
checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true