@@ -354,13 +354,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
354
354
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
355
355
} ) ;
356
356
} ;
357
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
358
+ if ( mod && mod . __esModule ) return mod ;
359
+ var result = { } ;
360
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
361
+ result [ "default" ] = mod ;
362
+ return result ;
363
+ } ;
357
364
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
358
- const os = __webpack_require__ ( 87 ) ;
359
- const events = __webpack_require__ ( 614 ) ;
360
- const child = __webpack_require__ ( 129 ) ;
361
- const path = __webpack_require__ ( 622 ) ;
362
- const io = __webpack_require__ ( 1 ) ;
363
- const ioUtil = __webpack_require__ ( 672 ) ;
365
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
366
+ const events = __importStar ( __webpack_require__ ( 614 ) ) ;
367
+ const child = __importStar ( __webpack_require__ ( 129 ) ) ;
368
+ const path = __importStar ( __webpack_require__ ( 622 ) ) ;
369
+ const io = __importStar ( __webpack_require__ ( 1 ) ) ;
370
+ const ioUtil = __importStar ( __webpack_require__ ( 672 ) ) ;
364
371
/* eslint-disable @typescript-eslint/unbound-method */
365
372
const IS_WINDOWS = process . platform === 'win32' ;
366
373
/*
@@ -804,6 +811,12 @@ class ToolRunner extends events.EventEmitter {
804
811
resolve ( exitCode ) ;
805
812
}
806
813
} ) ;
814
+ if ( this . options . input ) {
815
+ if ( ! cp . stdin ) {
816
+ throw new Error ( 'child process missing stdin' ) ;
817
+ }
818
+ cp . stdin . end ( this . options . input ) ;
819
+ }
807
820
} ) ;
808
821
} ) ;
809
822
}
@@ -3011,17 +3024,24 @@ module.exports = require("crypto");
3011
3024
3012
3025
"use strict" ;
3013
3026
3027
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
3028
+ if ( mod && mod . __esModule ) return mod ;
3029
+ var result = { } ;
3030
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
3031
+ result [ "default" ] = mod ;
3032
+ return result ;
3033
+ } ;
3014
3034
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3015
- const os = __webpack_require__ ( 87 ) ;
3035
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
3016
3036
/**
3017
3037
* Commands
3018
3038
*
3019
3039
* Command Format:
3020
- * ##[ name key=value; key=value] message
3040
+ * :: name key=value, key=value:: message
3021
3041
*
3022
3042
* Examples:
3023
- * ##[ warning] This is the user warning message
3024
- * ##[ set-secret name=mypassword]definitelyNotAPassword!
3043
+ * :: warning:: This is the message
3044
+ * :: set-env name=MY_VAR::some value
3025
3045
*/
3026
3046
function issueCommand ( command , properties , message ) {
3027
3047
const cmd = new Command ( command , properties , message ) ;
@@ -3046,34 +3066,53 @@ class Command {
3046
3066
let cmdStr = CMD_STRING + this . command ;
3047
3067
if ( this . properties && Object . keys ( this . properties ) . length > 0 ) {
3048
3068
cmdStr += ' ' ;
3069
+ let first = true ;
3049
3070
for ( const key in this . properties ) {
3050
3071
if ( this . properties . hasOwnProperty ( key ) ) {
3051
3072
const val = this . properties [ key ] ;
3052
3073
if ( val ) {
3053
- // safely append the val - avoid blowing up when attempting to
3054
- // call .replace() if message is not a string for some reason
3055
- cmdStr += `${ key } =${ escape ( `${ val || '' } ` ) } ,` ;
3074
+ if ( first ) {
3075
+ first = false ;
3076
+ }
3077
+ else {
3078
+ cmdStr += ',' ;
3079
+ }
3080
+ cmdStr += `${ key } =${ escapeProperty ( val ) } ` ;
3056
3081
}
3057
3082
}
3058
3083
}
3059
3084
}
3060
- cmdStr += CMD_STRING ;
3061
- // safely append the message - avoid blowing up when attempting to
3062
- // call .replace() if message is not a string for some reason
3063
- const message = `${ this . message || '' } ` ;
3064
- cmdStr += escapeData ( message ) ;
3085
+ cmdStr += `${ CMD_STRING } ${ escapeData ( this . message ) } ` ;
3065
3086
return cmdStr ;
3066
3087
}
3067
3088
}
3089
+ /**
3090
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
3091
+ * @param input input to sanitize into a string
3092
+ */
3093
+ function toCommandValue ( input ) {
3094
+ if ( input === null || input === undefined ) {
3095
+ return '' ;
3096
+ }
3097
+ else if ( typeof input === 'string' || input instanceof String ) {
3098
+ return input ;
3099
+ }
3100
+ return JSON . stringify ( input ) ;
3101
+ }
3102
+ exports . toCommandValue = toCommandValue ;
3068
3103
function escapeData ( s ) {
3069
- return s . replace ( / \r / g, '%0D' ) . replace ( / \n / g, '%0A' ) ;
3104
+ return toCommandValue ( s )
3105
+ . replace ( / % / g, '%25' )
3106
+ . replace ( / \r / g, '%0D' )
3107
+ . replace ( / \n / g, '%0A' ) ;
3070
3108
}
3071
- function escape ( s ) {
3072
- return s
3109
+ function escapeProperty ( s ) {
3110
+ return toCommandValue ( s )
3111
+ . replace ( / % / g, '%25' )
3073
3112
. replace ( / \r / g, '%0D' )
3074
3113
. replace ( / \n / g, '%0A' )
3075
- . replace ( / ] / g, '%5D ' )
3076
- . replace ( / ; / g, '%3B ' ) ;
3114
+ . replace ( / : / g, '%3A ' )
3115
+ . replace ( / , / g, '%2C ' ) ;
3077
3116
}
3078
3117
//# sourceMappingURL=command.js.map
3079
3118
@@ -3093,10 +3132,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
3093
3132
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
3094
3133
} ) ;
3095
3134
} ;
3135
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
3136
+ if ( mod && mod . __esModule ) return mod ;
3137
+ var result = { } ;
3138
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
3139
+ result [ "default" ] = mod ;
3140
+ return result ;
3141
+ } ;
3096
3142
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3097
3143
const command_1 = __webpack_require__ ( 431 ) ;
3098
- const os = __webpack_require__ ( 87 ) ;
3099
- const path = __webpack_require__ ( 622 ) ;
3144
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
3145
+ const path = __importStar ( __webpack_require__ ( 622 ) ) ;
3100
3146
/**
3101
3147
* The code to exit an action
3102
3148
*/
@@ -3117,11 +3163,13 @@ var ExitCode;
3117
3163
/**
3118
3164
* Sets env variable for this action and future actions in the job
3119
3165
* @param name the name of the variable to set
3120
- * @param val the value of the variable
3166
+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
3121
3167
*/
3168
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3122
3169
function exportVariable ( name , val ) {
3123
- process . env [ name ] = val ;
3124
- command_1 . issueCommand ( 'set-env' , { name } , val ) ;
3170
+ const convertedVal = command_1 . toCommandValue ( val ) ;
3171
+ process . env [ name ] = convertedVal ;
3172
+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3125
3173
}
3126
3174
exports . exportVariable = exportVariable ;
3127
3175
/**
@@ -3160,12 +3208,22 @@ exports.getInput = getInput;
3160
3208
* Sets the value of an output.
3161
3209
*
3162
3210
* @param name name of the output to set
3163
- * @param value value to store
3211
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
3164
3212
*/
3213
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3165
3214
function setOutput ( name , value ) {
3166
3215
command_1 . issueCommand ( 'set-output' , { name } , value ) ;
3167
3216
}
3168
3217
exports . setOutput = setOutput ;
3218
+ /**
3219
+ * Enables or disables the echoing of commands into stdout for the rest of the step.
3220
+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
3221
+ *
3222
+ */
3223
+ function setCommandEcho ( enabled ) {
3224
+ command_1 . issue ( 'echo' , enabled ? 'on' : 'off' ) ;
3225
+ }
3226
+ exports . setCommandEcho = setCommandEcho ;
3169
3227
//-----------------------------------------------------------------------
3170
3228
// Results
3171
3229
//-----------------------------------------------------------------------
@@ -3182,6 +3240,13 @@ exports.setFailed = setFailed;
3182
3240
//-----------------------------------------------------------------------
3183
3241
// Logging Commands
3184
3242
//-----------------------------------------------------------------------
3243
+ /**
3244
+ * Gets whether Actions Step Debug is on or not
3245
+ */
3246
+ function isDebug ( ) {
3247
+ return process . env [ 'RUNNER_DEBUG' ] === '1' ;
3248
+ }
3249
+ exports . isDebug = isDebug ;
3185
3250
/**
3186
3251
* Writes debug message to user log
3187
3252
* @param message debug message
@@ -3192,18 +3257,18 @@ function debug(message) {
3192
3257
exports . debug = debug ;
3193
3258
/**
3194
3259
* Adds an error issue
3195
- * @param message error issue message
3260
+ * @param message error issue message. Errors will be converted to string via toString()
3196
3261
*/
3197
3262
function error ( message ) {
3198
- command_1 . issue ( 'error' , message ) ;
3263
+ command_1 . issue ( 'error' , message instanceof Error ? message . toString ( ) : message ) ;
3199
3264
}
3200
3265
exports . error = error ;
3201
3266
/**
3202
3267
* Adds an warning issue
3203
- * @param message warning issue message
3268
+ * @param message warning issue message. Errors will be converted to string via toString()
3204
3269
*/
3205
3270
function warning ( message ) {
3206
- command_1 . issue ( 'warning' , message ) ;
3271
+ command_1 . issue ( 'warning' , message instanceof Error ? message . toString ( ) : message ) ;
3207
3272
}
3208
3273
exports . warning = warning ;
3209
3274
/**
@@ -3261,8 +3326,9 @@ exports.group = group;
3261
3326
* Saves state for current action, the state can only be retrieved by this action's post job execution.
3262
3327
*
3263
3328
* @param name name of the state to store
3264
- * @param value value to store
3329
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
3265
3330
*/
3331
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3266
3332
function saveState ( name , value ) {
3267
3333
command_1 . issueCommand ( 'save-state' , { name } , value ) ;
3268
3334
}
@@ -5551,8 +5617,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
5551
5617
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
5552
5618
} ) ;
5553
5619
} ;
5620
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
5621
+ if ( mod && mod . __esModule ) return mod ;
5622
+ var result = { } ;
5623
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
5624
+ result [ "default" ] = mod ;
5625
+ return result ;
5626
+ } ;
5554
5627
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
5555
- const tr = __webpack_require__ ( 9 ) ;
5628
+ const tr = __importStar ( __webpack_require__ ( 9 ) ) ;
5556
5629
/**
5557
5630
* Exec a command.
5558
5631
* Output will be streamed to the live console.
0 commit comments