-
-
Notifications
You must be signed in to change notification settings - Fork 41
38 lines (38 loc) · 1.21 KB
/
telegram-channel.yml
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
name: send telegram channel message
on:
push:
paths: 'dist/easy-upload.user.js'
branches: [master]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/github-script@v6
with:
script: |
try {
const { default: createTgChannelMsg } = await import('${{ github.workspace }}/scripts/tg-channel.js');
await createTgChannelMsg(core)
const text = process.env.tgMsg
const response = await fetch('https://api.telegram.org/bot${{secrets.TG_BOT_TOKEN}}/sendMessage',{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"chat_id": "-1001343736144",
text,
"parse_mode": "HTML"
})
})
const result = await response.json();
if(!response.ok){
core.setFailed(result.description);
}
}catch(error){
core.setFailed(error.message);
}