@@ -137,6 +137,32 @@ function onceStrict (fn) {
137137}
138138
139139
140+ /***/ } ) ,
141+
142+ /***/ 82 :
143+ /***/ ( function ( __unusedmodule , exports ) {
144+
145+ "use strict" ;
146+
147+ // We use any as a valid input type
148+ /* eslint-disable @typescript-eslint/no-explicit-any */
149+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
150+ /**
151+ * Sanitizes an input into a string so it can be passed into issueCommand safely
152+ * @param input input to sanitize into a string
153+ */
154+ function toCommandValue ( input ) {
155+ if ( input === null || input === undefined ) {
156+ return '' ;
157+ }
158+ else if ( typeof input === 'string' || input instanceof String ) {
159+ return input ;
160+ }
161+ return JSON . stringify ( input ) ;
162+ }
163+ exports . toCommandValue = toCommandValue ;
164+ //# sourceMappingURL=utils.js.map
165+
140166/***/ } ) ,
141167
142168/***/ 87 :
@@ -1074,6 +1100,42 @@ function regExpEscape (s) {
10741100}
10751101
10761102
1103+ /***/ } ) ,
1104+
1105+ /***/ 102 :
1106+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
1107+
1108+ "use strict" ;
1109+
1110+ // For internal use, subject to change.
1111+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1112+ if ( mod && mod . __esModule ) return mod ;
1113+ var result = { } ;
1114+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1115+ result [ "default" ] = mod ;
1116+ return result ;
1117+ } ;
1118+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1119+ // We use any as a valid input type
1120+ /* eslint-disable @typescript-eslint/no-explicit-any */
1121+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1122+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1123+ const utils_1 = __webpack_require__ ( 82 ) ;
1124+ function issueCommand ( command , message ) {
1125+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
1126+ if ( ! filePath ) {
1127+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
1128+ }
1129+ if ( ! fs . existsSync ( filePath ) ) {
1130+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
1131+ }
1132+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
1133+ encoding : 'utf8'
1134+ } ) ;
1135+ }
1136+ exports . issueCommand = issueCommand ;
1137+ //# sourceMappingURL=file-command.js.map
1138+
10771139/***/ } ) ,
10781140
10791141/***/ 117 :
@@ -4917,6 +4979,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
49174979} ;
49184980Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
49194981const os = __importStar ( __webpack_require__ ( 87 ) ) ;
4982+ const utils_1 = __webpack_require__ ( 82 ) ;
49204983/**
49214984 * Commands
49224985 *
@@ -4971,13 +5034,13 @@ class Command {
49715034 }
49725035}
49735036function escapeData ( s ) {
4974- return ( s || '' )
5037+ return utils_1 . toCommandValue ( s )
49755038 . replace ( / % / g, '%25' )
49765039 . replace ( / \r / g, '%0D' )
49775040 . replace ( / \n / g, '%0A' ) ;
49785041}
49795042function escapeProperty ( s ) {
4980- return ( s || '' )
5043+ return utils_1 . toCommandValue ( s )
49815044 . replace ( / % / g, '%25' )
49825045 . replace ( / \r / g, '%0D' )
49835046 . replace ( / \n / g, '%0A' )
@@ -5049,6 +5112,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
50495112} ;
50505113Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
50515114const command_1 = __webpack_require__ ( 431 ) ;
5115+ const file_command_1 = __webpack_require__ ( 102 ) ;
5116+ const utils_1 = __webpack_require__ ( 82 ) ;
50525117const os = __importStar ( __webpack_require__ ( 87 ) ) ;
50535118const path = __importStar ( __webpack_require__ ( 622 ) ) ;
50545119/**
@@ -5071,11 +5136,21 @@ var ExitCode;
50715136/**
50725137 * Sets env variable for this action and future actions in the job
50735138 * @param name the name of the variable to set
5074- * @param val the value of the variable
5139+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
50755140 */
5141+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50765142function exportVariable ( name , val ) {
5077- process . env [ name ] = val ;
5078- command_1 . issueCommand ( 'set-env' , { name } , val ) ;
5143+ const convertedVal = utils_1 . toCommandValue ( val ) ;
5144+ process . env [ name ] = convertedVal ;
5145+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
5146+ if ( filePath ) {
5147+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
5148+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
5149+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
5150+ }
5151+ else {
5152+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
5153+ }
50795154}
50805155exports . exportVariable = exportVariable ;
50815156/**
@@ -5091,7 +5166,13 @@ exports.setSecret = setSecret;
50915166 * @param inputPath
50925167 */
50935168function addPath ( inputPath ) {
5094- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
5169+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
5170+ if ( filePath ) {
5171+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
5172+ }
5173+ else {
5174+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
5175+ }
50955176 process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
50965177}
50975178exports . addPath = addPath ;
@@ -5114,12 +5195,22 @@ exports.getInput = getInput;
51145195 * Sets the value of an output.
51155196 *
51165197 * @param name name of the output to set
5117- * @param value value to store
5198+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
51185199 */
5200+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51195201function setOutput ( name , value ) {
51205202 command_1 . issueCommand ( 'set-output' , { name } , value ) ;
51215203}
51225204exports . setOutput = setOutput ;
5205+ /**
5206+ * Enables or disables the echoing of commands into stdout for the rest of the step.
5207+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
5208+ *
5209+ */
5210+ function setCommandEcho ( enabled ) {
5211+ command_1 . issue ( 'echo' , enabled ? 'on' : 'off' ) ;
5212+ }
5213+ exports . setCommandEcho = setCommandEcho ;
51235214//-----------------------------------------------------------------------
51245215// Results
51255216//-----------------------------------------------------------------------
@@ -5153,18 +5244,18 @@ function debug(message) {
51535244exports . debug = debug ;
51545245/**
51555246 * Adds an error issue
5156- * @param message error issue message
5247+ * @param message error issue message. Errors will be converted to string via toString()
51575248 */
51585249function error ( message ) {
5159- command_1 . issue ( 'error' , message ) ;
5250+ command_1 . issue ( 'error' , message instanceof Error ? message . toString ( ) : message ) ;
51605251}
51615252exports . error = error ;
51625253/**
51635254 * Adds an warning issue
5164- * @param message warning issue message
5255+ * @param message warning issue message. Errors will be converted to string via toString()
51655256 */
51665257function warning ( message ) {
5167- command_1 . issue ( 'warning' , message ) ;
5258+ command_1 . issue ( 'warning' , message instanceof Error ? message . toString ( ) : message ) ;
51685259}
51695260exports . warning = warning ;
51705261/**
@@ -5222,8 +5313,9 @@ exports.group = group;
52225313 * Saves state for current action, the state can only be retrieved by this action's post job execution.
52235314 *
52245315 * @param name name of the state to store
5225- * @param value value to store
5316+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
52265317 */
5318+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
52275319function saveState ( name , value ) {
52285320 command_1 . issueCommand ( 'save-state' , { name } , value ) ;
52295321}
0 commit comments