File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 19
19
steps :
20
20
- name : Checkout current PR code
21
21
uses : actions/checkout@v2
22
+ with :
23
+ fetch-depth : 0
22
24
23
25
- name : Install ruby version ${{ env.ruby_version }}
24
26
uses : ruby/setup-ruby@v1
28
30
- name : Prepare testing environment with bundler
29
31
run : bundle update --jobs 4 --retry 3
30
32
33
+ - name : Run commits check
34
+ run : bundle exec rake commits
35
+
31
36
- name : Run rubocop check
32
37
run : bundle exec rake ${{ env.extra_checks }} rubocop
33
38
Original file line number Diff line number Diff line change 85
85
end
86
86
end
87
87
88
+ desc "verify that commit messages match CONTRIBUTING.md requirements"
89
+ task ( :commits ) do
90
+ # This rake task looks at the summary from every commit from this branch not
91
+ # in the branch targeted for a PR.
92
+ commit_range = 'HEAD^..HEAD'
93
+ puts "Checking commits #{ commit_range } "
94
+ %x{git log --no-merges --pretty=%s #{ commit_range } } . each_line do |commit_summary |
95
+ # This regex tests for the currently supported commit summary tokens.
96
+ # The exception tries to explain it in more full.
97
+ if /^\( (maint|packaging|doc|docs|modules-\d +)\) |revert/i . match ( commit_summary ) . nil?
98
+ raise "\n \n \n \t This commit summary didn't match CONTRIBUTING.md guidelines:\n " \
99
+ "\n \t \t #{ commit_summary } \n " \
100
+ "\t The commit summary (i.e. the first line of the commit message) should start with one of:\n " \
101
+ "\t \t (MODULES-<digits>) # this is most common and should be a ticket at tickets.puppet.com\n " \
102
+ "\t \t (docs)\n " \
103
+ "\t \t (docs)(DOCUMENT-<digits>)\n " \
104
+ "\t \t (packaging)\n "
105
+ "\t \t (maint)\n " \
106
+ "\n \t This test for the commit summary is case-insensitive.\n \n \n "
107
+ else
108
+ puts "#{ commit_summary } "
109
+ end
110
+ puts "...passed"
111
+ end
112
+ end
You can’t perform that action at this time.
0 commit comments