@@ -151,6 +151,32 @@ function onceStrict (fn) {
151
151
}
152
152
153
153
154
+ /***/ } ) ,
155
+
156
+ /***/ 82 :
157
+ /***/ ( function ( __unusedmodule , exports ) {
158
+
159
+ "use strict" ;
160
+
161
+ // We use any as a valid input type
162
+ /* eslint-disable @typescript-eslint/no-explicit-any */
163
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
164
+ /**
165
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
166
+ * @param input input to sanitize into a string
167
+ */
168
+ function toCommandValue ( input ) {
169
+ if ( input === null || input === undefined ) {
170
+ return '' ;
171
+ }
172
+ else if ( typeof input === 'string' || input instanceof String ) {
173
+ return input ;
174
+ }
175
+ return JSON . stringify ( input ) ;
176
+ }
177
+ exports . toCommandValue = toCommandValue ;
178
+ //# sourceMappingURL=utils.js.map
179
+
154
180
/***/ } ) ,
155
181
156
182
/***/ 87 :
@@ -160,6 +186,42 @@ module.exports = require("os");
160
186
161
187
/***/ } ) ,
162
188
189
+ /***/ 102 :
190
+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
191
+
192
+ "use strict" ;
193
+
194
+ // For internal use, subject to change.
195
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
196
+ if ( mod && mod . __esModule ) return mod ;
197
+ var result = { } ;
198
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
199
+ result [ "default" ] = mod ;
200
+ return result ;
201
+ } ;
202
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
203
+ // We use any as a valid input type
204
+ /* eslint-disable @typescript-eslint/no-explicit-any */
205
+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
206
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
207
+ const utils_1 = __webpack_require__ ( 82 ) ;
208
+ function issueCommand ( command , message ) {
209
+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
210
+ if ( ! filePath ) {
211
+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
212
+ }
213
+ if ( ! fs . existsSync ( filePath ) ) {
214
+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
215
+ }
216
+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
217
+ encoding : 'utf8'
218
+ } ) ;
219
+ }
220
+ exports . issueCommand = issueCommand ;
221
+ //# sourceMappingURL=file-command.js.map
222
+
223
+ /***/ } ) ,
224
+
163
225
/***/ 127 :
164
226
/***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
165
227
@@ -1261,6 +1323,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
1261
1323
} ;
1262
1324
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1263
1325
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1326
+ const utils_1 = __webpack_require__ ( 82 ) ;
1264
1327
/**
1265
1328
* Commands
1266
1329
*
@@ -1314,28 +1377,14 @@ class Command {
1314
1377
return cmdStr ;
1315
1378
}
1316
1379
}
1317
- /**
1318
- * Sanitizes an input into a string so it can be passed into issueCommand safely
1319
- * @param input input to sanitize into a string
1320
- */
1321
- function toCommandValue ( input ) {
1322
- if ( input === null || input === undefined ) {
1323
- return '' ;
1324
- }
1325
- else if ( typeof input === 'string' || input instanceof String ) {
1326
- return input ;
1327
- }
1328
- return JSON . stringify ( input ) ;
1329
- }
1330
- exports . toCommandValue = toCommandValue ;
1331
1380
function escapeData ( s ) {
1332
- return toCommandValue ( s )
1381
+ return utils_1 . toCommandValue ( s )
1333
1382
. replace ( / % / g, '%25' )
1334
1383
. replace ( / \r / g, '%0D' )
1335
1384
. replace ( / \n / g, '%0A' ) ;
1336
1385
}
1337
1386
function escapeProperty ( s ) {
1338
- return toCommandValue ( s )
1387
+ return utils_1 . toCommandValue ( s )
1339
1388
. replace ( / % / g, '%25' )
1340
1389
. replace ( / \r / g, '%0D' )
1341
1390
. replace ( / \n / g, '%0A' )
@@ -3309,6 +3358,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
3309
3358
} ;
3310
3359
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3311
3360
const command_1 = __webpack_require__ ( 431 ) ;
3361
+ const file_command_1 = __webpack_require__ ( 102 ) ;
3362
+ const utils_1 = __webpack_require__ ( 82 ) ;
3312
3363
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
3313
3364
const path = __importStar ( __webpack_require__ ( 622 ) ) ;
3314
3365
/**
@@ -3335,9 +3386,17 @@ var ExitCode;
3335
3386
*/
3336
3387
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3337
3388
function exportVariable ( name , val ) {
3338
- const convertedVal = command_1 . toCommandValue ( val ) ;
3389
+ const convertedVal = utils_1 . toCommandValue ( val ) ;
3339
3390
process . env [ name ] = convertedVal ;
3340
- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3391
+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
3392
+ if ( filePath ) {
3393
+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
3394
+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
3395
+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
3396
+ }
3397
+ else {
3398
+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3399
+ }
3341
3400
}
3342
3401
exports . exportVariable = exportVariable ;
3343
3402
/**
@@ -3353,7 +3412,13 @@ exports.setSecret = setSecret;
3353
3412
* @param inputPath
3354
3413
*/
3355
3414
function addPath ( inputPath ) {
3356
- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
3415
+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
3416
+ if ( filePath ) {
3417
+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
3418
+ }
3419
+ else {
3420
+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
3421
+ }
3357
3422
process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
3358
3423
}
3359
3424
exports . addPath = addPath ;
0 commit comments