forked from olabiniV2/repo-notifications-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventHandler_status.js
30 lines (27 loc) · 1.24 KB
/
eventHandler_status.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
const a = require('./eventAccessors.js');
module.exports = (e, {subjectFormatter: sf, messageFormatter: mf}) => {
let subject = '';
let message = '';
switch(e.state) {
case 'pending':
subject = `${sf.format_front(e, a)} triggered a change in status - the repository is currently pending`;
message = `${mf.format_front(e, a)} triggered a change in status - the repository is currently pending`;
break;
case 'success':
subject = `${sf.format_front(e, a)} triggered a change in status - the current status is success`;
message = `${mf.format_front(e, a)} triggered a change in status - the current status is success`;
break;
case 'failure':
subject = `${sf.format_front(e, a)} triggered a change in status - the repository is now failing`;
message = `${mf.format_front(e, a)} triggered a change in status - the repository is now failing`;
break;
case 'error':
subject = `${sf.format_front(e, a)} triggered a change in status - the repository is now erroring`;
message = `${mf.format_front(e, a)} triggered a change in status - the repository is now erroring`;
break;
}
return {
subject: subject,
message: message,
};
};