Skip to content

Commit 19d1c0b

Browse files
committed
Merge pull request #21 from krasimir/master
Adding a snippet for templating the GitHub's pull request
2 parents d190a84 + e4eec39 commit 19d1c0b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

github-pull-request-template.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
(function(){
2+
var textareaId = '#pull_request_body';
3+
var textarea = document.querySelector(textareaId);
4+
var template = '';
5+
var firstLine;
6+
7+
template += firstLine = 'ID (ticket/card/issue): ';
8+
template += '\n\n';
9+
template += '## Task/Problem\n\n';
10+
template += '## Solution\n\n';
11+
template += '## Steps to reproduce\n\n';
12+
template += '## UAT\n\n';
13+
template += '## Code review\n\n\n';
14+
template += '- [ ] Unit tests passed\n';
15+
template += '- [ ] System tests passed\n';
16+
17+
if (textarea) {
18+
textarea.value = template;
19+
textarea.focus();
20+
textarea.scrollTop = 0;
21+
textarea.selectionStart = textarea.selectionEnd = firstLine.length;
22+
} else {
23+
alert('You are either not on the PR page or there is no ' + textareaId + ' element.');
24+
}
25+
})();

0 commit comments

Comments
 (0)