-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
pr-create.md.ejs
39 lines (29 loc) · 1.74 KB
/
pr-create.md.ejs
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
<%
var FLAG_PATTERN = /^(Breaking|Build|Chore|Docs|Fix|New|Update|Upgrade):/,
ISSUE_REF_PATTERN = /\((fixes|refs) #\d+.*?\)$/;
function isValidCommitFlag(log) {
var result = log.match(FLAG_PATTERN);
return !!result || log.indexOf("Revert \"") === 0;
}
var problems = [];
// Check for one commit per pull request
if (meta.commits) {
// get just the first line of the commit message
var log = meta.commits[0].commit.message.split(/\r?\n/g)[0];
if (!isValidCommitFlag(log)) {
problems.push("The commit summary needs to begin with a tag (such as `Fix:` or `Update:`). Please check out our [guide](http://eslint.org/docs/developer-guide/contributing/pull-requests#step-2-make-your-changes) for how to properly format your commit summary and [update](http://eslint.org/docs/developer-guide/contributing/pull-requests#updating-the-commit-message) it on this pull request.")
}
if (log.length > 72) {
problems.push("The commit summary must be 72 characters or shorter. Please check out our [guide](http://eslint.org/docs/developer-guide/contributing/pull-requests#step-2-make-your-changes) for how to properly format your commit summary and [update](http://eslint.org/docs/developer-guide/contributing/pull-requests#updating-the-commit-message) it on this pull request.");
}
}
if (problems.length) { %>
Thanks for the pull request, @<%= payload.sender.login %>! I took a look to make sure it's ready for merging and found some changes are needed:
<% problems.forEach(function(problem) { %>
* <%- problem %>
<% }); %>
Can you please update the pull request to address these?
(More information can be found in our [pull request guide](http://eslint.org/docs/developer-guide/contributing/pull-requests).)
<% } else { %>
LGTM
<% } %>