AFFiNE/scripts/notify.mjs

19 lines
620 B
JavaScript
Raw Normal View History

2022-12-17 19:51:15 +03:00
import got from 'got';
const STAGE_HOST = 'https://nightly.affine.pro/';
if (['master', 'develop'].includes(process.env.CF_PAGES_BRANCH)) {
2023-02-14 21:52:45 +03:00
const message = `Daily builds: New deployment of version ${process.env.CF_PAGES_COMMIT_SHA} was deploy: [nightly](${STAGE_HOST}) / [internal](${process.env.CF_PAGES_URL})`;
const url = `https://api.telegram.org/bot${process.env.BOT_TOKEN}/sendMessage`;
2022-12-17 19:51:15 +03:00
got
.post(url, {
json: {
chat_id: process.env.CHAT_ID,
text: message,
parse_mode: 'Markdown',
disable_notification: true,
},
})
.then(r => console.log(r.body));
2022-12-17 19:51:15 +03:00
}