@@ -643,6 +643,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
643
643
} ;
644
644
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
645
645
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
646
+ const utils_1 = __webpack_require__ ( 278 ) ;
646
647
/**
647
648
* Commands
648
649
*
@@ -696,28 +697,14 @@ class Command {
696
697
return cmdStr ;
697
698
}
698
699
}
699
- /**
700
- * Sanitizes an input into a string so it can be passed into issueCommand safely
701
- * @param input input to sanitize into a string
702
- */
703
- function toCommandValue ( input ) {
704
- if ( input === null || input === undefined ) {
705
- return '' ;
706
- }
707
- else if ( typeof input === 'string' || input instanceof String ) {
708
- return input ;
709
- }
710
- return JSON . stringify ( input ) ;
711
- }
712
- exports . toCommandValue = toCommandValue ;
713
700
function escapeData ( s ) {
714
- return toCommandValue ( s )
701
+ return utils_1 . toCommandValue ( s )
715
702
. replace ( / % / g, '%25' )
716
703
. replace ( / \r / g, '%0D' )
717
704
. replace ( / \n / g, '%0A' ) ;
718
705
}
719
706
function escapeProperty ( s ) {
720
- return toCommandValue ( s )
707
+ return utils_1 . toCommandValue ( s )
721
708
. replace ( / % / g, '%25' )
722
709
. replace ( / \r / g, '%0D' )
723
710
. replace ( / \n / g, '%0A' )
@@ -751,6 +738,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
751
738
} ;
752
739
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
753
740
const command_1 = __webpack_require__ ( 351 ) ;
741
+ const file_command_1 = __webpack_require__ ( 717 ) ;
742
+ const utils_1 = __webpack_require__ ( 278 ) ;
754
743
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
755
744
const path = __importStar ( __webpack_require__ ( 622 ) ) ;
756
745
/**
@@ -777,9 +766,17 @@ var ExitCode;
777
766
*/
778
767
// eslint-disable-next-line @typescript-eslint/no-explicit-any
779
768
function exportVariable ( name , val ) {
780
- const convertedVal = command_1 . toCommandValue ( val ) ;
769
+ const convertedVal = utils_1 . toCommandValue ( val ) ;
781
770
process . env [ name ] = convertedVal ;
782
- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
771
+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
772
+ if ( filePath ) {
773
+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
774
+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
775
+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
776
+ }
777
+ else {
778
+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
779
+ }
783
780
}
784
781
exports . exportVariable = exportVariable ;
785
782
/**
@@ -795,7 +792,13 @@ exports.setSecret = setSecret;
795
792
* @param inputPath
796
793
*/
797
794
function addPath ( inputPath ) {
798
- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
795
+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
796
+ if ( filePath ) {
797
+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
798
+ }
799
+ else {
800
+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
801
+ }
799
802
process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
800
803
}
801
804
exports . addPath = addPath ;
@@ -957,6 +960,68 @@ exports.getState = getState;
957
960
958
961
/***/ } ) ,
959
962
963
+ /***/ 717 :
964
+ /***/ ( function ( __unused_webpack_module , exports , __webpack_require__ ) {
965
+
966
+ "use strict" ;
967
+
968
+ // For internal use, subject to change.
969
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
970
+ if ( mod && mod . __esModule ) return mod ;
971
+ var result = { } ;
972
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
973
+ result [ "default" ] = mod ;
974
+ return result ;
975
+ } ;
976
+ Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
977
+ // We use any as a valid input type
978
+ /* eslint-disable @typescript-eslint/no-explicit-any */
979
+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
980
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
981
+ const utils_1 = __webpack_require__ ( 278 ) ;
982
+ function issueCommand ( command , message ) {
983
+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
984
+ if ( ! filePath ) {
985
+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
986
+ }
987
+ if ( ! fs . existsSync ( filePath ) ) {
988
+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
989
+ }
990
+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
991
+ encoding : 'utf8'
992
+ } ) ;
993
+ }
994
+ exports . issueCommand = issueCommand ;
995
+ //# sourceMappingURL=file-command.js.map
996
+
997
+ /***/ } ) ,
998
+
999
+ /***/ 278 :
1000
+ /***/ ( ( __unused_webpack_module , exports ) => {
1001
+
1002
+ "use strict" ;
1003
+
1004
+ // We use any as a valid input type
1005
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1006
+ Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
1007
+ /**
1008
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
1009
+ * @param input input to sanitize into a string
1010
+ */
1011
+ function toCommandValue ( input ) {
1012
+ if ( input === null || input === undefined ) {
1013
+ return '' ;
1014
+ }
1015
+ else if ( typeof input === 'string' || input instanceof String ) {
1016
+ return input ;
1017
+ }
1018
+ return JSON . stringify ( input ) ;
1019
+ }
1020
+ exports . toCommandValue = toCommandValue ;
1021
+ //# sourceMappingURL=utils.js.map
1022
+
1023
+ /***/ } ) ,
1024
+
960
1025
/***/ 53 :
961
1026
/***/ ( ( __unused_webpack_module , exports , __webpack_require__ ) => {
962
1027
0 commit comments