import * as exec from "@actions/exec" ; import * as toolCache from "@actions/tool-cache" ; param platform param url param args export async function downloadAndRunScript ( platform , url , args ? ) { const scriptPath = await toolCache . downloadTool ( url ) ; const cmd = generateExecCommand ( platform , scriptPath ) ; const exitCode = await exec . exec ( cmd , args ) ; if ( exitCode !== 0 ) { return Promise . reject ( Error ( `Script exited with non-zero code ${ exitCode }` ) ) ; } } param platform param scriptPath export function generateExecCommand ( platform , scriptPath ) { let installCmd = `bash ${ scriptPath }` ; if ( platform !== "win32" ) { installCmd = `sudo -E ${ installCmd }` ; } return installCmd ; }