@@ -67,6 +67,8 @@ const inputs: Array<Inputs> = ["compiler", "architecture", ...tools]
67
67
68
68
/** The main entry function */
69
69
export async function main ( args : string [ ] ) : Promise < number > {
70
+ const isCI = Boolean ( process . env . CI )
71
+
70
72
// parse options using mri or github actions
71
73
const opts = mri < Record < Inputs , string | undefined > & { help : boolean } > ( args , {
72
74
string : inputs ,
@@ -162,18 +164,18 @@ export async function main(args: string[]): Promise<number> {
162
164
if ( installationInfo !== undefined ) {
163
165
successMessages . push ( getSuccessMessage ( tool , installationInfo ) )
164
166
} else {
165
- successMessages . push ( ` ${ tool } was successfully installed` )
167
+ successMessages . push ( `${ tool } was successfully installed` )
166
168
}
167
169
} catch ( e ) {
168
170
// push error message to the logger
169
- errorMessages . push ( ` ${ tool } failed to install` )
171
+ errorMessages . push ( `${ tool } failed to install` )
170
172
}
171
173
}
172
174
}
173
175
174
176
// report the messages in the end
175
- successMessages . forEach ( ( tool ) => core . info ( tool ) )
176
- errorMessages . forEach ( ( tool ) => core . error ( tool ) )
177
+ successMessages . forEach ( ( tool ) => ( isCI ? core . info ( tool ) : console . log ( `\x1b[32m ${ tool } \x1b[0m` ) ) )
178
+ errorMessages . forEach ( ( tool ) => ( isCI ? core . error ( tool ) : console . log ( `\x1b[31m ${ tool } \x1b[0m` ) ) )
177
179
178
180
core . info ( "setup_cpp finished" )
179
181
return errorMessages . length === 0 ? 0 : 1 // exit with non-zero if any error message
@@ -230,7 +232,7 @@ function maybeGetInput(key: string) {
230
232
}
231
233
232
234
function getSuccessMessage ( tool : string , installationInfo : InstallationInfo ) {
233
- let success = ` ${ tool } was successfully installed`
235
+ let success = `${ tool } was successfully installed`
234
236
if ( "installDir" in installationInfo ) {
235
237
success += `\nThe installation direcotry is ${ installationInfo . installDir } `
236
238
}
0 commit comments