@@ -43,13 +43,75 @@ module.exports =
43
43
/************************************************************************/
44
44
/******/ ( {
45
45
46
+ /***/ 82 :
47
+ /***/ ( function ( __unusedmodule , exports ) {
48
+
49
+ "use strict" ;
50
+
51
+ // We use any as a valid input type
52
+ /* eslint-disable @typescript-eslint/no-explicit-any */
53
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
54
+ /**
55
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
56
+ * @param input input to sanitize into a string
57
+ */
58
+ function toCommandValue ( input ) {
59
+ if ( input === null || input === undefined ) {
60
+ return '' ;
61
+ }
62
+ else if ( typeof input === 'string' || input instanceof String ) {
63
+ return input ;
64
+ }
65
+ return JSON . stringify ( input ) ;
66
+ }
67
+ exports . toCommandValue = toCommandValue ;
68
+ //# sourceMappingURL=utils.js.map
69
+
70
+ /***/ } ) ,
71
+
46
72
/***/ 87 :
47
73
/***/ ( function ( module ) {
48
74
49
75
module . exports = require ( "os" ) ;
50
76
51
77
/***/ } ) ,
52
78
79
+ /***/ 102 :
80
+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
81
+
82
+ "use strict" ;
83
+
84
+ // For internal use, subject to change.
85
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
86
+ if ( mod && mod . __esModule ) return mod ;
87
+ var result = { } ;
88
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
89
+ result [ "default" ] = mod ;
90
+ return result ;
91
+ } ;
92
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
93
+ // We use any as a valid input type
94
+ /* eslint-disable @typescript-eslint/no-explicit-any */
95
+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
96
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
97
+ const utils_1 = __webpack_require__ ( 82 ) ;
98
+ function issueCommand ( command , message ) {
99
+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
100
+ if ( ! filePath ) {
101
+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
102
+ }
103
+ if ( ! fs . existsSync ( filePath ) ) {
104
+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
105
+ }
106
+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
107
+ encoding : 'utf8'
108
+ } ) ;
109
+ }
110
+ exports . issueCommand = issueCommand ;
111
+ //# sourceMappingURL=file-command.js.map
112
+
113
+ /***/ } ) ,
114
+
53
115
/***/ 129 :
54
116
/***/ ( function ( module ) {
55
117
@@ -89,6 +151,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
89
151
} ;
90
152
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
91
153
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
154
+ const utils_1 = __webpack_require__ ( 82 ) ;
92
155
/**
93
156
* Commands
94
157
*
@@ -142,28 +205,14 @@ class Command {
142
205
return cmdStr ;
143
206
}
144
207
}
145
- /**
146
- * Sanitizes an input into a string so it can be passed into issueCommand safely
147
- * @param input input to sanitize into a string
148
- */
149
- function toCommandValue ( input ) {
150
- if ( input === null || input === undefined ) {
151
- return '' ;
152
- }
153
- else if ( typeof input === 'string' || input instanceof String ) {
154
- return input ;
155
- }
156
- return JSON . stringify ( input ) ;
157
- }
158
- exports . toCommandValue = toCommandValue ;
159
208
function escapeData ( s ) {
160
- return toCommandValue ( s )
209
+ return utils_1 . toCommandValue ( s )
161
210
. replace ( / % / g, '%25' )
162
211
. replace ( / \r / g, '%0D' )
163
212
. replace ( / \n / g, '%0A' ) ;
164
213
}
165
214
function escapeProperty ( s ) {
166
- return toCommandValue ( s )
215
+ return utils_1 . toCommandValue ( s )
167
216
. replace ( / % / g, '%25' )
168
217
. replace ( / \r / g, '%0D' )
169
218
. replace ( / \n / g, '%0A' )
@@ -197,6 +246,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
197
246
} ;
198
247
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
199
248
const command_1 = __webpack_require__ ( 431 ) ;
249
+ const file_command_1 = __webpack_require__ ( 102 ) ;
250
+ const utils_1 = __webpack_require__ ( 82 ) ;
200
251
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
201
252
const path = __importStar ( __webpack_require__ ( 622 ) ) ;
202
253
/**
@@ -223,9 +274,17 @@ var ExitCode;
223
274
*/
224
275
// eslint-disable-next-line @typescript-eslint/no-explicit-any
225
276
function exportVariable ( name , val ) {
226
- const convertedVal = command_1 . toCommandValue ( val ) ;
277
+ const convertedVal = utils_1 . toCommandValue ( val ) ;
227
278
process . env [ name ] = convertedVal ;
228
- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
279
+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
280
+ if ( filePath ) {
281
+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
282
+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
283
+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
284
+ }
285
+ else {
286
+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
287
+ }
229
288
}
230
289
exports . exportVariable = exportVariable ;
231
290
/**
@@ -241,7 +300,13 @@ exports.setSecret = setSecret;
241
300
* @param inputPath
242
301
*/
243
302
function addPath ( inputPath ) {
244
- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
303
+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
304
+ if ( filePath ) {
305
+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
306
+ }
307
+ else {
308
+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
309
+ }
245
310
process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
246
311
}
247
312
exports . addPath = addPath ;
@@ -408,6 +473,13 @@ exports.getState = getState;
408
473
409
474
module . exports = require ( "path" ) ;
410
475
476
+ /***/ } ) ,
477
+
478
+ /***/ 747 :
479
+ /***/ ( function ( module ) {
480
+
481
+ module . exports = require ( "fs" ) ;
482
+
411
483
/***/ } )
412
484
413
485
/******/ } ) ;
0 commit comments