@@ -1073,13 +1073,75 @@ exports._readLinuxVersionFile = _readLinuxVersionFile;
1073
1073
1074
1074
/***/ } ) ,
1075
1075
1076
+ /***/ 82 :
1077
+ /***/ ( function ( __unusedmodule , exports ) {
1078
+
1079
+ "use strict" ;
1080
+
1081
+ // We use any as a valid input type
1082
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1083
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1084
+ /**
1085
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
1086
+ * @param input input to sanitize into a string
1087
+ */
1088
+ function toCommandValue ( input ) {
1089
+ if ( input === null || input === undefined ) {
1090
+ return '' ;
1091
+ }
1092
+ else if ( typeof input === 'string' || input instanceof String ) {
1093
+ return input ;
1094
+ }
1095
+ return JSON . stringify ( input ) ;
1096
+ }
1097
+ exports . toCommandValue = toCommandValue ;
1098
+ //# sourceMappingURL=utils.js.map
1099
+
1100
+ /***/ } ) ,
1101
+
1076
1102
/***/ 87 :
1077
1103
/***/ ( function ( module ) {
1078
1104
1079
1105
module . exports = require ( "os" ) ;
1080
1106
1081
1107
/***/ } ) ,
1082
1108
1109
+ /***/ 102 :
1110
+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
1111
+
1112
+ "use strict" ;
1113
+
1114
+ // For internal use, subject to change.
1115
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1116
+ if ( mod && mod . __esModule ) return mod ;
1117
+ var result = { } ;
1118
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1119
+ result [ "default" ] = mod ;
1120
+ return result ;
1121
+ } ;
1122
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1123
+ // We use any as a valid input type
1124
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1125
+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1126
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1127
+ const utils_1 = __webpack_require__ ( 82 ) ;
1128
+ function issueCommand ( command , message ) {
1129
+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
1130
+ if ( ! filePath ) {
1131
+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
1132
+ }
1133
+ if ( ! fs . existsSync ( filePath ) ) {
1134
+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
1135
+ }
1136
+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
1137
+ encoding : 'utf8'
1138
+ } ) ;
1139
+ }
1140
+ exports . issueCommand = issueCommand ;
1141
+ //# sourceMappingURL=file-command.js.map
1142
+
1143
+ /***/ } ) ,
1144
+
1083
1145
/***/ 129 :
1084
1146
/***/ ( function ( module ) {
1085
1147
@@ -3128,6 +3190,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
3128
3190
} ;
3129
3191
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3130
3192
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
3193
+ const utils_1 = __webpack_require__ ( 82 ) ;
3131
3194
/**
3132
3195
* Commands
3133
3196
*
@@ -3181,28 +3244,14 @@ class Command {
3181
3244
return cmdStr ;
3182
3245
}
3183
3246
}
3184
- /**
3185
- * Sanitizes an input into a string so it can be passed into issueCommand safely
3186
- * @param input input to sanitize into a string
3187
- */
3188
- function toCommandValue ( input ) {
3189
- if ( input === null || input === undefined ) {
3190
- return '' ;
3191
- }
3192
- else if ( typeof input === 'string' || input instanceof String ) {
3193
- return input ;
3194
- }
3195
- return JSON . stringify ( input ) ;
3196
- }
3197
- exports . toCommandValue = toCommandValue ;
3198
3247
function escapeData ( s ) {
3199
- return toCommandValue ( s )
3248
+ return utils_1 . toCommandValue ( s )
3200
3249
. replace ( / % / g, '%25' )
3201
3250
. replace ( / \r / g, '%0D' )
3202
3251
. replace ( / \n / g, '%0A' ) ;
3203
3252
}
3204
3253
function escapeProperty ( s ) {
3205
- return toCommandValue ( s )
3254
+ return utils_1 . toCommandValue ( s )
3206
3255
. replace ( / % / g, '%25' )
3207
3256
. replace ( / \r / g, '%0D' )
3208
3257
. replace ( / \n / g, '%0A' )
@@ -3236,6 +3285,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
3236
3285
} ;
3237
3286
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3238
3287
const command_1 = __webpack_require__ ( 431 ) ;
3288
+ const file_command_1 = __webpack_require__ ( 102 ) ;
3289
+ const utils_1 = __webpack_require__ ( 82 ) ;
3239
3290
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
3240
3291
const path = __importStar ( __webpack_require__ ( 622 ) ) ;
3241
3292
/**
@@ -3262,9 +3313,17 @@ var ExitCode;
3262
3313
*/
3263
3314
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3264
3315
function exportVariable ( name , val ) {
3265
- const convertedVal = command_1 . toCommandValue ( val ) ;
3316
+ const convertedVal = utils_1 . toCommandValue ( val ) ;
3266
3317
process . env [ name ] = convertedVal ;
3267
- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3318
+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
3319
+ if ( filePath ) {
3320
+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
3321
+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
3322
+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
3323
+ }
3324
+ else {
3325
+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3326
+ }
3268
3327
}
3269
3328
exports . exportVariable = exportVariable ;
3270
3329
/**
@@ -3280,7 +3339,13 @@ exports.setSecret = setSecret;
3280
3339
* @param inputPath
3281
3340
*/
3282
3341
function addPath ( inputPath ) {
3283
- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
3342
+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
3343
+ if ( filePath ) {
3344
+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
3345
+ }
3346
+ else {
3347
+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
3348
+ }
3284
3349
process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
3285
3350
}
3286
3351
exports . addPath = addPath ;
0 commit comments