import * as core from "@actions/core" ; import * as exec from "@actions/exec" ; import * as fs from "fs" ; import * as path from "path" ; import { Links } from "./links" ; async function run ( ) { try { const cliPath = path . normalize ( `${ __dirname }\\..\\node_modules\\@vsintellicode\\cli\\CLI` ) ; core . addPath ( cliPath ) ; let directory = process . env . GITHUB_WORKSPACE ; const overrideDirectory = core . getInput ( "directory" ) ; const overrideLoggingType = core . getInput ( "logs" ) ; if ( overrideDirectory ) { core . info ( `overriding directory with given path: '${ overrideDirectory }'` ) ; directory = overrideDirectory ; } if ( ! directory ) { throw Error ( "A workspace directory was not found in the current CI environment." ) ; } else { if ( ! fs . existsSync ( directory ) ) { throw Error ( `Workspace directory '${ directory }' doesn't exists in the file system.` ) ; } } let verbosity = "n" ; if ( overrideLoggingType === "debug" ) { verbosity = "diag" ; } const args = [ "train" , "--directory" , directory , "--anonymous" , "--verbosity" , verbosity , "--user-agent" , "GitHub" , ] ; const config = core . getInput ( "config" ) ; const platform = core . getInput ( "platform" ) ; process . env . CPP_EXTRACT_MODE = "CI" ; if ( config && platform ) { args . push ( "--configuration" , config , "--platform" , platform ) ; } exec . exec ( "intellicode.exe" , args ) ; } catch ( error ) { core . error ( error . message ) ; } } run ( ) ;