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 } ) ` ;
2022-12-30 16:40:15 +03:00
const url = ` https://api.telegram.org/bot ${ process . env . BOT _TOKEN } /sendMessage ` ;
2022-12-17 19:51:15 +03:00
2022-12-30 16:40: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
}