File tree Expand file tree Collapse file tree 4 files changed +43
-3
lines changed
Expand file tree Collapse file tree 4 files changed +43
-3
lines changed Original file line number Diff line number Diff line change 1+ name : Commit Message Lint
2+ on :
3+ pull_request :
4+ branches : [ "main" ]
5+
6+ jobs :
7+ gitlint :
8+ runs-on : ubuntu-latest
9+
10+ steps :
11+ - uses : actions/checkout@v3
12+ with :
13+ ref : ${{ github.ref }}
14+ fetch-depth : 0
15+
16+ - name : Install gitlint
17+ shell : bash
18+ run : |
19+ python -m pip install gitlint
20+
21+ - name : Run gitlint
22+ shell : bash
23+ run : |
24+ gitlint --commit ${{ github.event.pull_request.head.sha }} --debug
Original file line number Diff line number Diff line change 1+ # Commit msg lint config
2+
3+ ## https://jorisroovers.com/gitlint/latest/ignoring_commits/
4+ ## https://jorisroovers.com/gitlint/latest/rules/builtin_rules/
5+
6+ [general]
7+ regex-style-search=true
8+ ignore=B1,B6
9+
10+ # Ensure every title starts with a user-story identifier like US123
11+ [title-match-regex]
12+ regex="feat(:|\(.*\):)|fix(:|\(.*\):)|style(:|\(.*\):)|refactor(:|\(.*\):)|test(:|\(.*\):)|docs(:|\(.*\):)|chore(:|\(.*\):)|build(:|\(.*\):)|ci(:|\(.*\):)|perf(:|\(.*\):)|metric(:|\(.*\):)|misc(:|\(.*\):)|release:"gi
13+
14+ # Ignore Release commits
15+ [ignore-by-title]
16+ regex=Release(.*)
17+ ignore=all
Original file line number Diff line number Diff line change 4040 @echo " -------------------------------------------------------------------"
4141
4242.PHONY : prepare
43- prepare : install-tools go-vendor # # Initialize the go environment
43+ prepare : git-env install-tools go-vendor # # Initialize the go environment
4444
4545.PHONY : test
4646test : prepare # # Run all go-sdk tests
Original file line number Diff line number Diff line change 22readonly project_name=go-sdk
33readonly commit_tags=" feat(:|\(.*\):)|fix(:|\(.*\):)|style(:|\(.*\):)|refactor(:|\(.*\):)|test(:|\(.*\):)|docs(:|\(.*\):)|chore(:|\(.*\):)|build(:|\(.*\):)|ci(:|\(.*\):)|perf(:|\(.*\):)|metric(:|\(.*\):)|misc(:|\(.*\):)|release:"
44readonly commit_message=` cat $1 `
5- readonly blah=" Please enter the commit message for your changes"
65
76validate_commit_message (){
87 if ! [[ $commit_message =~ $commit_tags ]]; then
98 invalid_message
109 exit 1
1110 fi
1211 log " Commit message is valid"
13- }
12+ }
1413
1514invalid_message (){
1615 log " Invalid commit message"
You can’t perform that action at this time.
0 commit comments