forked from athul/telewire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
125 lines (89 loc) · 2.79 KB
/
index.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
require("dotenv").config
const Bot=require('node-telegram-bot-api');
const {
INPUT_STATUS: ipstatus,
INPUT_TOKEN: tgtoken,
INPUT_CHAT: chatid,
INPUT_IU_TITLE: ititle,
INPUT_IU_NUM: inum,
INPUT_IU_ACTOR: iactor,
INPUT_IU_BODY: ibody,
INPUT_PR_NUM: pnum,
INPUT_PR_STATE: prstate,
INPUT_PR_TITLE: ptitle,
INPUT_PR_BODY: pbody,
GITHUB_EVENT_NAME: ghevent,
GITHUB_REPOSITORY: repo,
GITHUB_ACTOR: ghactor,
GITHUB_SHA: sha,
GITHUB_WORKFLOW: ghwrkflw
} = process.env;
const bot=new Bot(tgtoken)
const evresp = (gevent) => {
switch (gevent) {
case "issues":
return `
❗️❗️❗️❗️❗️❗️
Issue ${prstate}
Issue Title and Number : ${ititle} | #${inum}
Commented or Created By : \`${iactor}\`
Issue Body : *${ibody}*
[Link to Issue](https://github.com/${repo}/issues/${inum})
[Link to Repo ](https://github.com/${repo}/)
[Build log here](https://github.com/${repo}/commit/${sha}/checks)`
case "issue_comment":
return `
🗣🗣🗣🗣🗣🗣
Issue ${prstate}
Issue Title and Number : ${ititle} | #${inum}
Commented or Created By : \`${iactor}\`
Issue Body : *${ibody}*
Issue Comment: \`${process.env.INPUT_IU_COM}\`
[Link to Issue](https://github.com/${repo}/issues/${inum})
[Link to Repo ](https://github.com/${repo}/)
[Build log here](https://github.com/${repo}/commit/${sha}/checks)
`
case "pull_request":
return `
🔃🔀🔃🔀🔃🔀
PR ${prstate}
PR Number: ${pnum}
PR Title: ${ptitle}
PR Body: *${pbody}*
PR By: ${ghactor}
[Link to Issue](https://github.com/${repo}/pull/${pnum})
[Link to Repo ](https://github.com/${repo}/)
[Build log here](https://github.com/${repo}/commit/${sha}/checks)`
case "watch":
return `
⭐️⭐️⭐️
By: *${ghactor}*
\`Repository: ${repo}\`
Star Count ${process.env.INPUT_STARGAZERS}
Fork Count ${process.env.INPUT_FORKERS}
[Link to Repo ](https://github.com/${repo}/)
`
case "schedule":
return `
⏱⏰⏱⏰⏱⏰
ID: ${ghwrkflw}
Run *${ipstatus}!*
*Action was Run on Schedule*
\`Repository: ${repo}\`
[Link to Repo ](https://github.com/${repo}/)
`
default:
return `
⬆️⇅⬆️⇅
ID: ${ghwrkflw}
Action was a *${ipstatus}!*
\`Repository: ${repo}\`
On: *${ghevent}*
By: *${ghactor}*
Tag: ${process.env.GITHUB_REF}
[Link to Repo ](https://github.com/${repo}/)
`
}
}
const output = evresp(ghevent)
bot.sendMessage(chatid,output,{parse_mode : "Markdown"})