@@ -49,13 +49,75 @@ module.exports =
49
49
/************************************************************************/
50
50
/******/ ( {
51
51
52
+ /***/ 82 :
53
+ /***/ ( function ( __unusedmodule , exports ) {
54
+
55
+ "use strict" ;
56
+
57
+ // We use any as a valid input type
58
+ /* eslint-disable @typescript-eslint/no-explicit-any */
59
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
60
+ /**
61
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
62
+ * @param input input to sanitize into a string
63
+ */
64
+ function toCommandValue ( input ) {
65
+ if ( input === null || input === undefined ) {
66
+ return '' ;
67
+ }
68
+ else if ( typeof input === 'string' || input instanceof String ) {
69
+ return input ;
70
+ }
71
+ return JSON . stringify ( input ) ;
72
+ }
73
+ exports . toCommandValue = toCommandValue ;
74
+ //# sourceMappingURL=utils.js.map
75
+
76
+ /***/ } ) ,
77
+
52
78
/***/ 87 :
53
79
/***/ ( function ( module ) {
54
80
55
81
module . exports = require ( "os" ) ;
56
82
57
83
/***/ } ) ,
58
84
85
+ /***/ 102 :
86
+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
87
+
88
+ "use strict" ;
89
+
90
+ // For internal use, subject to change.
91
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
92
+ if ( mod && mod . __esModule ) return mod ;
93
+ var result = { } ;
94
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
95
+ result [ "default" ] = mod ;
96
+ return result ;
97
+ } ;
98
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
99
+ // We use any as a valid input type
100
+ /* eslint-disable @typescript-eslint/no-explicit-any */
101
+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
102
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
103
+ const utils_1 = __webpack_require__ ( 82 ) ;
104
+ function issueCommand ( command , message ) {
105
+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
106
+ if ( ! filePath ) {
107
+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
108
+ }
109
+ if ( ! fs . existsSync ( filePath ) ) {
110
+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
111
+ }
112
+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
113
+ encoding : 'utf8'
114
+ } ) ;
115
+ }
116
+ exports . issueCommand = issueCommand ;
117
+ //# sourceMappingURL=file-command.js.map
118
+
119
+ /***/ } ) ,
120
+
59
121
/***/ 175 :
60
122
/***/ ( function ( module , __unusedexports , __webpack_require__ ) {
61
123
@@ -113,6 +175,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
113
175
} ;
114
176
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
115
177
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
178
+ const utils_1 = __webpack_require__ ( 82 ) ;
116
179
/**
117
180
* Commands
118
181
*
@@ -166,28 +229,14 @@ class Command {
166
229
return cmdStr ;
167
230
}
168
231
}
169
- /**
170
- * Sanitizes an input into a string so it can be passed into issueCommand safely
171
- * @param input input to sanitize into a string
172
- */
173
- function toCommandValue ( input ) {
174
- if ( input === null || input === undefined ) {
175
- return '' ;
176
- }
177
- else if ( typeof input === 'string' || input instanceof String ) {
178
- return input ;
179
- }
180
- return JSON . stringify ( input ) ;
181
- }
182
- exports . toCommandValue = toCommandValue ;
183
232
function escapeData ( s ) {
184
- return toCommandValue ( s )
233
+ return utils_1 . toCommandValue ( s )
185
234
. replace ( / % / g, '%25' )
186
235
. replace ( / \r / g, '%0D' )
187
236
. replace ( / \n / g, '%0A' ) ;
188
237
}
189
238
function escapeProperty ( s ) {
190
- return toCommandValue ( s )
239
+ return utils_1 . toCommandValue ( s )
191
240
. replace ( / % / g, '%25' )
192
241
. replace ( / \r / g, '%0D' )
193
242
. replace ( / \n / g, '%0A' )
@@ -221,6 +270,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
221
270
} ;
222
271
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
223
272
const command_1 = __webpack_require__ ( 431 ) ;
273
+ const file_command_1 = __webpack_require__ ( 102 ) ;
274
+ const utils_1 = __webpack_require__ ( 82 ) ;
224
275
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
225
276
const path = __importStar ( __webpack_require__ ( 622 ) ) ;
226
277
/**
@@ -247,9 +298,17 @@ var ExitCode;
247
298
*/
248
299
// eslint-disable-next-line @typescript-eslint/no-explicit-any
249
300
function exportVariable ( name , val ) {
250
- const convertedVal = command_1 . toCommandValue ( val ) ;
301
+ const convertedVal = utils_1 . toCommandValue ( val ) ;
251
302
process . env [ name ] = convertedVal ;
252
- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
303
+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
304
+ if ( filePath ) {
305
+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
306
+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
307
+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
308
+ }
309
+ else {
310
+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
311
+ }
253
312
}
254
313
exports . exportVariable = exportVariable ;
255
314
/**
@@ -265,7 +324,13 @@ exports.setSecret = setSecret;
265
324
* @param inputPath
266
325
*/
267
326
function addPath ( inputPath ) {
268
- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
327
+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
328
+ if ( filePath ) {
329
+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
330
+ }
331
+ else {
332
+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
333
+ }
269
334
process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
270
335
}
271
336
exports . addPath = addPath ;
@@ -432,6 +497,13 @@ exports.getState = getState;
432
497
433
498
module . exports = require ( "path" ) ;
434
499
500
+ /***/ } ) ,
501
+
502
+ /***/ 747 :
503
+ /***/ ( function ( module ) {
504
+
505
+ module . exports = require ( "fs" ) ;
506
+
435
507
/***/ } )
436
508
437
509
/******/ } ) ;
0 commit comments