@@ -354,13 +354,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
354354 step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
355355 } ) ;
356356} ;
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+ } ;
357364Object . 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 ) ) ;
364371/* eslint-disable @typescript-eslint/unbound-method */
365372const IS_WINDOWS = process . platform === 'win32' ;
366373/*
@@ -804,6 +811,12 @@ class ToolRunner extends events.EventEmitter {
804811 resolve ( exitCode ) ;
805812 }
806813 } ) ;
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+ }
807820 } ) ;
808821 } ) ;
809822 }
@@ -3011,17 +3024,24 @@ module.exports = require("crypto");
30113024
30123025"use strict" ;
30133026
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+ } ;
30143034Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3015- const os = __webpack_require__ ( 87 ) ;
3035+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
30163036/**
30173037 * Commands
30183038 *
30193039 * Command Format:
3020- * ##[ name key=value; key=value] message
3040+ * :: name key=value, key=value:: message
30213041 *
30223042 * 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
30253045 */
30263046function issueCommand ( command , properties , message ) {
30273047 const cmd = new Command ( command , properties , message ) ;
@@ -3046,34 +3066,53 @@ class Command {
30463066 let cmdStr = CMD_STRING + this . command ;
30473067 if ( this . properties && Object . keys ( this . properties ) . length > 0 ) {
30483068 cmdStr += ' ' ;
3069+ let first = true ;
30493070 for ( const key in this . properties ) {
30503071 if ( this . properties . hasOwnProperty ( key ) ) {
30513072 const val = this . properties [ key ] ;
30523073 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 ) } ` ;
30563081 }
30573082 }
30583083 }
30593084 }
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 ) } ` ;
30653086 return cmdStr ;
30663087 }
30673088}
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 ;
30683103function 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' ) ;
30703108}
3071- function escape ( s ) {
3072- return s
3109+ function escapeProperty ( s ) {
3110+ return toCommandValue ( s )
3111+ . replace ( / % / g, '%25' )
30733112 . replace ( / \r / g, '%0D' )
30743113 . replace ( / \n / g, '%0A' )
3075- . replace ( / ] / g, '%5D ' )
3076- . replace ( / ; / g, '%3B ' ) ;
3114+ . replace ( / : / g, '%3A ' )
3115+ . replace ( / , / g, '%2C ' ) ;
30773116}
30783117//# sourceMappingURL=command.js.map
30793118
@@ -3093,10 +3132,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
30933132 step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
30943133 } ) ;
30953134} ;
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+ } ;
30963142Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
30973143const 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 ) ) ;
31003146/**
31013147 * The code to exit an action
31023148 */
@@ -3117,11 +3163,13 @@ var ExitCode;
31173163/**
31183164 * Sets env variable for this action and future actions in the job
31193165 * @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
31213167 */
3168+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31223169function 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 ) ;
31253173}
31263174exports . exportVariable = exportVariable ;
31273175/**
@@ -3160,12 +3208,22 @@ exports.getInput = getInput;
31603208 * Sets the value of an output.
31613209 *
31623210 * @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
31643212 */
3213+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31653214function setOutput ( name , value ) {
31663215 command_1 . issueCommand ( 'set-output' , { name } , value ) ;
31673216}
31683217exports . 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 ;
31693227//-----------------------------------------------------------------------
31703228// Results
31713229//-----------------------------------------------------------------------
@@ -3182,6 +3240,13 @@ exports.setFailed = setFailed;
31823240//-----------------------------------------------------------------------
31833241// Logging Commands
31843242//-----------------------------------------------------------------------
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 ;
31853250/**
31863251 * Writes debug message to user log
31873252 * @param message debug message
@@ -3192,18 +3257,18 @@ function debug(message) {
31923257exports . debug = debug ;
31933258/**
31943259 * Adds an error issue
3195- * @param message error issue message
3260+ * @param message error issue message. Errors will be converted to string via toString()
31963261 */
31973262function error ( message ) {
3198- command_1 . issue ( 'error' , message ) ;
3263+ command_1 . issue ( 'error' , message instanceof Error ? message . toString ( ) : message ) ;
31993264}
32003265exports . error = error ;
32013266/**
32023267 * Adds an warning issue
3203- * @param message warning issue message
3268+ * @param message warning issue message. Errors will be converted to string via toString()
32043269 */
32053270function warning ( message ) {
3206- command_1 . issue ( 'warning' , message ) ;
3271+ command_1 . issue ( 'warning' , message instanceof Error ? message . toString ( ) : message ) ;
32073272}
32083273exports . warning = warning ;
32093274/**
@@ -3261,8 +3326,9 @@ exports.group = group;
32613326 * Saves state for current action, the state can only be retrieved by this action's post job execution.
32623327 *
32633328 * @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
32653330 */
3331+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32663332function saveState ( name , value ) {
32673333 command_1 . issueCommand ( 'save-state' , { name } , value ) ;
32683334}
@@ -5551,8 +5617,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
55515617 step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
55525618 } ) ;
55535619} ;
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+ } ;
55545627Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
5555- const tr = __webpack_require__ ( 9 ) ;
5628+ const tr = __importStar ( __webpack_require__ ( 9 ) ) ;
55565629/**
55575630 * Exec a command.
55585631 * Output will be streamed to the live console.
0 commit comments