@@ -16,6 +16,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
1616} ;
1717Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
1818const os = __importStar ( __webpack_require__ ( 87 ) ) ;
19+ const utils_1 = __webpack_require__ ( 278 ) ;
1920/**
2021 * Commands
2122 *
@@ -69,28 +70,14 @@ class Command {
6970 return cmdStr ;
7071 }
7172}
72- /**
73- * Sanitizes an input into a string so it can be passed into issueCommand safely
74- * @param input input to sanitize into a string
75- */
76- function toCommandValue ( input ) {
77- if ( input === null || input === undefined ) {
78- return '' ;
79- }
80- else if ( typeof input === 'string' || input instanceof String ) {
81- return input ;
82- }
83- return JSON . stringify ( input ) ;
84- }
85- exports . toCommandValue = toCommandValue ;
8673function escapeData ( s ) {
87- return toCommandValue ( s )
74+ return utils_1 . toCommandValue ( s )
8875 . replace ( / % / g, '%25' )
8976 . replace ( / \r / g, '%0D' )
9077 . replace ( / \n / g, '%0A' ) ;
9178}
9279function escapeProperty ( s ) {
93- return toCommandValue ( s )
80+ return utils_1 . toCommandValue ( s )
9481 . replace ( / % / g, '%25' )
9582 . replace ( / \r / g, '%0D' )
9683 . replace ( / \n / g, '%0A' )
@@ -124,6 +111,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
124111} ;
125112Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
126113const command_1 = __webpack_require__ ( 351 ) ;
114+ const file_command_1 = __webpack_require__ ( 717 ) ;
115+ const utils_1 = __webpack_require__ ( 278 ) ;
127116const os = __importStar ( __webpack_require__ ( 87 ) ) ;
128117const path = __importStar ( __webpack_require__ ( 622 ) ) ;
129118/**
@@ -150,9 +139,17 @@ var ExitCode;
150139 */
151140// eslint-disable-next-line @typescript-eslint/no-explicit-any
152141function exportVariable ( name , val ) {
153- const convertedVal = command_1 . toCommandValue ( val ) ;
142+ const convertedVal = utils_1 . toCommandValue ( val ) ;
154143 process . env [ name ] = convertedVal ;
155- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
144+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
145+ if ( filePath ) {
146+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
147+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
148+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
149+ }
150+ else {
151+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
152+ }
156153}
157154exports . exportVariable = exportVariable ;
158155/**
@@ -168,7 +165,13 @@ exports.setSecret = setSecret;
168165 * @param inputPath
169166 */
170167function addPath ( inputPath ) {
171- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
168+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
169+ if ( filePath ) {
170+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
171+ }
172+ else {
173+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
174+ }
172175 process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
173176}
174177exports . addPath = addPath ;
@@ -330,6 +333,68 @@ exports.getState = getState;
330333
331334/***/ } ) ,
332335
336+ /***/ 717 :
337+ /***/ ( function ( __unused_webpack_module , exports , __webpack_require__ ) {
338+
339+ "use strict" ;
340+
341+ // For internal use, subject to change.
342+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
343+ if ( mod && mod . __esModule ) return mod ;
344+ var result = { } ;
345+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
346+ result [ "default" ] = mod ;
347+ return result ;
348+ } ;
349+ Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
350+ // We use any as a valid input type
351+ /* eslint-disable @typescript-eslint/no-explicit-any */
352+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
353+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
354+ const utils_1 = __webpack_require__ ( 278 ) ;
355+ function issueCommand ( command , message ) {
356+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
357+ if ( ! filePath ) {
358+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
359+ }
360+ if ( ! fs . existsSync ( filePath ) ) {
361+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
362+ }
363+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
364+ encoding : 'utf8'
365+ } ) ;
366+ }
367+ exports . issueCommand = issueCommand ;
368+ //# sourceMappingURL=file-command.js.map
369+
370+ /***/ } ) ,
371+
372+ /***/ 278 :
373+ /***/ ( ( __unused_webpack_module , exports ) => {
374+
375+ "use strict" ;
376+
377+ // We use any as a valid input type
378+ /* eslint-disable @typescript-eslint/no-explicit-any */
379+ Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
380+ /**
381+ * Sanitizes an input into a string so it can be passed into issueCommand safely
382+ * @param input input to sanitize into a string
383+ */
384+ function toCommandValue ( input ) {
385+ if ( input === null || input === undefined ) {
386+ return '' ;
387+ }
388+ else if ( typeof input === 'string' || input instanceof String ) {
389+ return input ;
390+ }
391+ return JSON . stringify ( input ) ;
392+ }
393+ exports . toCommandValue = toCommandValue ;
394+ //# sourceMappingURL=utils.js.map
395+
396+ /***/ } ) ,
397+
333398/***/ 514 :
334399/***/ ( function ( __unused_webpack_module , exports , __webpack_require__ ) {
335400
0 commit comments