@@ -700,6 +700,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
700
700
} ;
701
701
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
702
702
const command_1 = __webpack_require__ ( 241 ) ;
703
+ const file_command_1 = __webpack_require__ ( 717 ) ;
704
+ const utils_1 = __webpack_require__ ( 278 ) ;
703
705
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
704
706
const path = __importStar ( __webpack_require__ ( 622 ) ) ;
705
707
/**
@@ -726,9 +728,17 @@ var ExitCode;
726
728
*/
727
729
// eslint-disable-next-line @typescript-eslint/no-explicit-any
728
730
function exportVariable ( name , val ) {
729
- const convertedVal = command_1 . toCommandValue ( val ) ;
731
+ const convertedVal = utils_1 . toCommandValue ( val ) ;
730
732
process . env [ name ] = convertedVal ;
731
- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
733
+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
734
+ if ( filePath ) {
735
+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
736
+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
737
+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
738
+ }
739
+ else {
740
+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
741
+ }
732
742
}
733
743
exports . exportVariable = exportVariable ;
734
744
/**
@@ -744,7 +754,13 @@ exports.setSecret = setSecret;
744
754
* @param inputPath
745
755
*/
746
756
function addPath ( inputPath ) {
747
- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
757
+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
758
+ if ( filePath ) {
759
+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
760
+ }
761
+ else {
762
+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
763
+ }
748
764
process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
749
765
}
750
766
exports . addPath = addPath ;
@@ -1199,6 +1215,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
1199
1215
} ;
1200
1216
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1201
1217
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1218
+ const utils_1 = __webpack_require__ ( 278 ) ;
1202
1219
/**
1203
1220
* Commands
1204
1221
*
@@ -1252,6 +1269,32 @@ class Command {
1252
1269
return cmdStr ;
1253
1270
}
1254
1271
}
1272
+ function escapeData ( s ) {
1273
+ return utils_1 . toCommandValue ( s )
1274
+ . replace ( / % / g, '%25' )
1275
+ . replace ( / \r / g, '%0D' )
1276
+ . replace ( / \n / g, '%0A' ) ;
1277
+ }
1278
+ function escapeProperty ( s ) {
1279
+ return utils_1 . toCommandValue ( s )
1280
+ . replace ( / % / g, '%25' )
1281
+ . replace ( / \r / g, '%0D' )
1282
+ . replace ( / \n / g, '%0A' )
1283
+ . replace ( / : / g, '%3A' )
1284
+ . replace ( / , / g, '%2C' ) ;
1285
+ }
1286
+ //# sourceMappingURL=command.js.map
1287
+
1288
+ /***/ } ) ,
1289
+
1290
+ /***/ 278 :
1291
+ /***/ ( function ( __unusedmodule , exports ) {
1292
+
1293
+ "use strict" ;
1294
+
1295
+ // We use any as a valid input type
1296
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1297
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1255
1298
/**
1256
1299
* Sanitizes an input into a string so it can be passed into issueCommand safely
1257
1300
* @param input input to sanitize into a string
@@ -1266,21 +1309,7 @@ function toCommandValue(input) {
1266
1309
return JSON . stringify ( input ) ;
1267
1310
}
1268
1311
exports . toCommandValue = toCommandValue ;
1269
- function escapeData ( s ) {
1270
- return toCommandValue ( s )
1271
- . replace ( / % / g, '%25' )
1272
- . replace ( / \r / g, '%0D' )
1273
- . replace ( / \n / g, '%0A' ) ;
1274
- }
1275
- function escapeProperty ( s ) {
1276
- return toCommandValue ( s )
1277
- . replace ( / % / g, '%25' )
1278
- . replace ( / \r / g, '%0D' )
1279
- . replace ( / \n / g, '%0A' )
1280
- . replace ( / : / g, '%3A' )
1281
- . replace ( / , / g, '%2C' ) ;
1282
- }
1283
- //# sourceMappingURL=command.js.map
1312
+ //# sourceMappingURL=utils.js.map
1284
1313
1285
1314
/***/ } ) ,
1286
1315
@@ -2120,6 +2149,42 @@ function bytesToUuid(buf, offset) {
2120
2149
module . exports = bytesToUuid ;
2121
2150
2122
2151
2152
+ /***/ } ) ,
2153
+
2154
+ /***/ 717 :
2155
+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
2156
+
2157
+ "use strict" ;
2158
+
2159
+ // For internal use, subject to change.
2160
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
2161
+ if ( mod && mod . __esModule ) return mod ;
2162
+ var result = { } ;
2163
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
2164
+ result [ "default" ] = mod ;
2165
+ return result ;
2166
+ } ;
2167
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
2168
+ // We use any as a valid input type
2169
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2170
+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
2171
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
2172
+ const utils_1 = __webpack_require__ ( 278 ) ;
2173
+ function issueCommand ( command , message ) {
2174
+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
2175
+ if ( ! filePath ) {
2176
+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
2177
+ }
2178
+ if ( ! fs . existsSync ( filePath ) ) {
2179
+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
2180
+ }
2181
+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
2182
+ encoding : 'utf8'
2183
+ } ) ;
2184
+ }
2185
+ exports . issueCommand = issueCommand ;
2186
+ //# sourceMappingURL=file-command.js.map
2187
+
2123
2188
/***/ } ) ,
2124
2189
2125
2190
/***/ 747 :
0 commit comments