forked from olabiniV2/repo-notifications-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventHandler_pull_request.js
34 lines (31 loc) · 1.02 KB
/
eventHandler_pull_request.js
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
const a = require('./eventAccessors.js');
module.exports = (e, {subjectFormatter: sf, messageFormatter: mf}) => {
let subject = '';
let message = '';
switch(e.action) {
case 'opened':
case 'edited':
case 'closed':
case 'assigned':
case 'unassigned':
case 'review_requested':
case 'review_request_removed':
case 'ready_for_review':
case 'converted_to_draft':
case 'labeled':
case 'unlabeled':
case 'synchronize':
case 'auto_merge_enabled':
case 'auto_merge_disabled':
case 'locked':
case 'unlocked':
case 'reopened':
subject = `${sf.format_front(e, a)} ${e.action} this pull request: ${sf.format_link(e.pull_request.html_url, "#" + e.pull_request.number)}`;
message = `${mf.format_front(e, a)} ${e.action} this pull request: ${mf.format_link(e.pull_request.html_url, "#" + e.pull_request.number)} - ${mf.format_emphasis(e.pull_request.title)}.`;
break;
}
return {
subject: subject,
message: message,
};
};