2022-12-17 19:51:15 +03:00
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
2023-06-08 07:41:47 +03:00
fetch ( url , {
method : 'POST' ,
headers : {
'Content-Type' : 'application/json' ,
} ,
body : JSON . stringify ( {
chat _id : process . env . CHAT _ID ,
text : message ,
parse _mode : 'Markdown' ,
disable _notification : true ,
} ) ,
} )
. then ( r => r . json ( ) )
. then ( console . log ) ;
2022-12-17 19:51:15 +03:00
}