@@ -1067,13 +1067,75 @@ exports._readLinuxVersionFile = _readLinuxVersionFile;
1067
1067
1068
1068
/***/ } ) ,
1069
1069
1070
+ /***/ 82 :
1071
+ /***/ ( function ( __unusedmodule , exports ) {
1072
+
1073
+ "use strict" ;
1074
+
1075
+ // We use any as a valid input type
1076
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1077
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1078
+ /**
1079
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
1080
+ * @param input input to sanitize into a string
1081
+ */
1082
+ function toCommandValue ( input ) {
1083
+ if ( input === null || input === undefined ) {
1084
+ return '' ;
1085
+ }
1086
+ else if ( typeof input === 'string' || input instanceof String ) {
1087
+ return input ;
1088
+ }
1089
+ return JSON . stringify ( input ) ;
1090
+ }
1091
+ exports . toCommandValue = toCommandValue ;
1092
+ //# sourceMappingURL=utils.js.map
1093
+
1094
+ /***/ } ) ,
1095
+
1070
1096
/***/ 87 :
1071
1097
/***/ ( function ( module ) {
1072
1098
1073
1099
module . exports = require ( "os" ) ;
1074
1100
1075
1101
/***/ } ) ,
1076
1102
1103
+ /***/ 102 :
1104
+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
1105
+
1106
+ "use strict" ;
1107
+
1108
+ // For internal use, subject to change.
1109
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1110
+ if ( mod && mod . __esModule ) return mod ;
1111
+ var result = { } ;
1112
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1113
+ result [ "default" ] = mod ;
1114
+ return result ;
1115
+ } ;
1116
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1117
+ // We use any as a valid input type
1118
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1119
+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1120
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1121
+ const utils_1 = __webpack_require__ ( 82 ) ;
1122
+ function issueCommand ( command , message ) {
1123
+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
1124
+ if ( ! filePath ) {
1125
+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
1126
+ }
1127
+ if ( ! fs . existsSync ( filePath ) ) {
1128
+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
1129
+ }
1130
+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
1131
+ encoding : 'utf8'
1132
+ } ) ;
1133
+ }
1134
+ exports . issueCommand = issueCommand ;
1135
+ //# sourceMappingURL=file-command.js.map
1136
+
1137
+ /***/ } ) ,
1138
+
1077
1139
/***/ 129 :
1078
1140
/***/ ( function ( module ) {
1079
1141
@@ -3150,6 +3212,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
3150
3212
} ;
3151
3213
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3152
3214
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
3215
+ const utils_1 = __webpack_require__ ( 82 ) ;
3153
3216
/**
3154
3217
* Commands
3155
3218
*
@@ -3203,28 +3266,14 @@ class Command {
3203
3266
return cmdStr ;
3204
3267
}
3205
3268
}
3206
- /**
3207
- * Sanitizes an input into a string so it can be passed into issueCommand safely
3208
- * @param input input to sanitize into a string
3209
- */
3210
- function toCommandValue ( input ) {
3211
- if ( input === null || input === undefined ) {
3212
- return '' ;
3213
- }
3214
- else if ( typeof input === 'string' || input instanceof String ) {
3215
- return input ;
3216
- }
3217
- return JSON . stringify ( input ) ;
3218
- }
3219
- exports . toCommandValue = toCommandValue ;
3220
3269
function escapeData ( s ) {
3221
- return toCommandValue ( s )
3270
+ return utils_1 . toCommandValue ( s )
3222
3271
. replace ( / % / g, '%25' )
3223
3272
. replace ( / \r / g, '%0D' )
3224
3273
. replace ( / \n / g, '%0A' ) ;
3225
3274
}
3226
3275
function escapeProperty ( s ) {
3227
- return toCommandValue ( s )
3276
+ return utils_1 . toCommandValue ( s )
3228
3277
. replace ( / % / g, '%25' )
3229
3278
. replace ( / \r / g, '%0D' )
3230
3279
. replace ( / \n / g, '%0A' )
@@ -3258,6 +3307,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
3258
3307
} ;
3259
3308
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3260
3309
const command_1 = __webpack_require__ ( 431 ) ;
3310
+ const file_command_1 = __webpack_require__ ( 102 ) ;
3311
+ const utils_1 = __webpack_require__ ( 82 ) ;
3261
3312
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
3262
3313
const path = __importStar ( __webpack_require__ ( 622 ) ) ;
3263
3314
/**
@@ -3284,9 +3335,17 @@ var ExitCode;
3284
3335
*/
3285
3336
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3286
3337
function exportVariable ( name , val ) {
3287
- const convertedVal = command_1 . toCommandValue ( val ) ;
3338
+ const convertedVal = utils_1 . toCommandValue ( val ) ;
3288
3339
process . env [ name ] = convertedVal ;
3289
- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3340
+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
3341
+ if ( filePath ) {
3342
+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
3343
+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
3344
+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
3345
+ }
3346
+ else {
3347
+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3348
+ }
3290
3349
}
3291
3350
exports . exportVariable = exportVariable ;
3292
3351
/**
@@ -3302,7 +3361,13 @@ exports.setSecret = setSecret;
3302
3361
* @param inputPath
3303
3362
*/
3304
3363
function addPath ( inputPath ) {
3305
- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
3364
+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
3365
+ if ( filePath ) {
3366
+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
3367
+ }
3368
+ else {
3369
+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
3370
+ }
3306
3371
process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
3307
3372
}
3308
3373
exports . addPath = addPath ;
0 commit comments