import * as exec from '@actions/exec' ; export async function build ( ) { await exec . exec ( 'yarn' , [ 'install' ] ) ; await exec . exec ( 'yarn' , [ 'build:libs' ] ) ; await exec . exec ( 'yarn' , [ 'build' ] ) ; await exec . exec ( 'yarn' , [ 'build:ssr' ] ) ; } param context param octoKit param comment export async function addComment ( context , octoKit , comment ) { const COMMENT_HEADER = '## Hosting service deployment' ; const issueNumber = context . payload . pull_request . number ; const owner = context . payload . repository . owner . login ; const repo = context . payload . repository . name ; const body = `${ COMMENT_HEADER }\n${ comment }` ; const comments = await octoKit . issues . listComments ( { issue_number : issueNumber , owner , repo , } ) ; const botComment = comments . data . filter ( ( comment ) => comment . body . includes ( COMMENT_HEADER ) && comment . user . login === 'github-actions[bot]' ) ; if ( botComment && botComment . length ) { await octoKit . issues . deleteComment ( { comment_id : botComment [ 0 ] . id , owner , repo , } ) ; } await octoKit . issues . createComment ( { issue_number : issueNumber , owner , repo , body , } ) ; } param branch export function getBundleId ( branch ) { let bundleId = '' ; const regex = /(\-\d)/ ; branch . toLowerCase ( ) . replace ( /\//g , '-s' ) . replace ( /\./g , '-d' ) . replace ( /_/g , '-' ) . split ( regex ) . forEach ( ( s ) => { if ( s . match ( regex ) ) { bundleId += s . substring ( 0 , 1 ) + 'i' + s . substring ( 1 , 2 ) ; } else { bundleId += s ; } } ) ; console . log ( `--> Generated bundle ID: ${ bundleId }` ) ; return bundleId ; }