@@ -354,13 +354,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
354
354
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
355
355
} ) ;
356
356
} ;
357
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
358
+ if ( mod && mod . __esModule ) return mod ;
359
+ var result = { } ;
360
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
361
+ result [ "default" ] = mod ;
362
+ return result ;
363
+ } ;
357
364
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
358
- const os = __webpack_require__ ( 87 ) ;
359
- const events = __webpack_require__ ( 614 ) ;
360
- const child = __webpack_require__ ( 129 ) ;
361
- const path = __webpack_require__ ( 622 ) ;
362
- const io = __webpack_require__ ( 1 ) ;
363
- const ioUtil = __webpack_require__ ( 672 ) ;
365
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
366
+ const events = __importStar ( __webpack_require__ ( 614 ) ) ;
367
+ const child = __importStar ( __webpack_require__ ( 129 ) ) ;
368
+ const path = __importStar ( __webpack_require__ ( 622 ) ) ;
369
+ const io = __importStar ( __webpack_require__ ( 1 ) ) ;
370
+ const ioUtil = __importStar ( __webpack_require__ ( 672 ) ) ;
364
371
/* eslint-disable @typescript-eslint/unbound-method */
365
372
const IS_WINDOWS = process . platform === 'win32' ;
366
373
/*
@@ -804,6 +811,12 @@ class ToolRunner extends events.EventEmitter {
804
811
resolve ( exitCode ) ;
805
812
}
806
813
} ) ;
814
+ if ( this . options . input ) {
815
+ if ( ! cp . stdin ) {
816
+ throw new Error ( 'child process missing stdin' ) ;
817
+ }
818
+ cp . stdin . end ( this . options . input ) ;
819
+ }
807
820
} ) ;
808
821
} ) ;
809
822
}
@@ -990,6 +1003,22 @@ function getInput(name, mandatory) {
990
1003
} ) ;
991
1004
}
992
1005
exports . getInput = getInput ;
1006
+ /**
1007
+ * Function to filter extensions
1008
+ *
1009
+ * @param extension_csv
1010
+ */
1011
+ function filterExtensions ( extension_csv ) {
1012
+ return __awaiter ( this , void 0 , void 0 , function * ( ) {
1013
+ return extension_csv
1014
+ . split ( ',' )
1015
+ . filter ( extension => {
1016
+ return extension . trim ( ) [ 0 ] != ':' ;
1017
+ } )
1018
+ . join ( ',' ) ;
1019
+ } ) ;
1020
+ }
1021
+ exports . filterExtensions = filterExtensions ;
993
1022
994
1023
995
1024
/***/ } ) ,
@@ -1068,14 +1097,28 @@ class Command {
1068
1097
return cmdStr ;
1069
1098
}
1070
1099
}
1100
+ /**
1101
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
1102
+ * @param input input to sanitize into a string
1103
+ */
1104
+ function toCommandValue ( input ) {
1105
+ if ( input === null || input === undefined ) {
1106
+ return '' ;
1107
+ }
1108
+ else if ( typeof input === 'string' || input instanceof String ) {
1109
+ return input ;
1110
+ }
1111
+ return JSON . stringify ( input ) ;
1112
+ }
1113
+ exports . toCommandValue = toCommandValue ;
1071
1114
function escapeData ( s ) {
1072
- return ( s || '' )
1115
+ return toCommandValue ( s )
1073
1116
. replace ( / % / g, '%25' )
1074
1117
. replace ( / \r / g, '%0D' )
1075
1118
. replace ( / \n / g, '%0A' ) ;
1076
1119
}
1077
1120
function escapeProperty ( s ) {
1078
- return ( s || '' )
1121
+ return toCommandValue ( s )
1079
1122
. replace ( / % / g, '%25' )
1080
1123
. replace ( / \r / g, '%0D' )
1081
1124
. replace ( / \n / g, '%0A' )
@@ -1131,11 +1174,13 @@ var ExitCode;
1131
1174
/**
1132
1175
* Sets env variable for this action and future actions in the job
1133
1176
* @param name the name of the variable to set
1134
- * @param val the value of the variable
1177
+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
1135
1178
*/
1179
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1136
1180
function exportVariable ( name , val ) {
1137
- process . env [ name ] = val ;
1138
- command_1 . issueCommand ( 'set-env' , { name } , val ) ;
1181
+ const convertedVal = command_1 . toCommandValue ( val ) ;
1182
+ process . env [ name ] = convertedVal ;
1183
+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
1139
1184
}
1140
1185
exports . exportVariable = exportVariable ;
1141
1186
/**
@@ -1174,12 +1219,22 @@ exports.getInput = getInput;
1174
1219
* Sets the value of an output.
1175
1220
*
1176
1221
* @param name name of the output to set
1177
- * @param value value to store
1222
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
1178
1223
*/
1224
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1179
1225
function setOutput ( name , value ) {
1180
1226
command_1 . issueCommand ( 'set-output' , { name } , value ) ;
1181
1227
}
1182
1228
exports . setOutput = setOutput ;
1229
+ /**
1230
+ * Enables or disables the echoing of commands into stdout for the rest of the step.
1231
+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
1232
+ *
1233
+ */
1234
+ function setCommandEcho ( enabled ) {
1235
+ command_1 . issue ( 'echo' , enabled ? 'on' : 'off' ) ;
1236
+ }
1237
+ exports . setCommandEcho = setCommandEcho ;
1183
1238
//-----------------------------------------------------------------------
1184
1239
// Results
1185
1240
//-----------------------------------------------------------------------
@@ -1213,18 +1268,18 @@ function debug(message) {
1213
1268
exports . debug = debug ;
1214
1269
/**
1215
1270
* Adds an error issue
1216
- * @param message error issue message
1271
+ * @param message error issue message. Errors will be converted to string via toString()
1217
1272
*/
1218
1273
function error ( message ) {
1219
- command_1 . issue ( 'error' , message ) ;
1274
+ command_1 . issue ( 'error' , message instanceof Error ? message . toString ( ) : message ) ;
1220
1275
}
1221
1276
exports . error = error ;
1222
1277
/**
1223
1278
* Adds an warning issue
1224
- * @param message warning issue message
1279
+ * @param message warning issue message. Errors will be converted to string via toString()
1225
1280
*/
1226
1281
function warning ( message ) {
1227
- command_1 . issue ( 'warning' , message ) ;
1282
+ command_1 . issue ( 'warning' , message instanceof Error ? message . toString ( ) : message ) ;
1228
1283
}
1229
1284
exports . warning = warning ;
1230
1285
/**
@@ -1282,8 +1337,9 @@ exports.group = group;
1282
1337
* Saves state for current action, the state can only be retrieved by this action's post job execution.
1283
1338
*
1284
1339
* @param name name of the state to store
1285
- * @param value value to store
1340
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
1286
1341
*/
1342
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1287
1343
function saveState ( name , value ) {
1288
1344
command_1 . issueCommand ( 'save-state' , { name } , value ) ;
1289
1345
}
@@ -1559,7 +1615,7 @@ function run() {
1559
1615
try {
1560
1616
let version = yield utils . getInput ( 'php-version' , true ) ;
1561
1617
version = version . length > 1 ? version . slice ( 0 , 3 ) : version + '.0' ;
1562
- const extensions = yield utils . getInput ( 'extensions' , true ) ;
1618
+ const extensions = yield utils . filterExtensions ( yield utils . getInput ( 'extensions' , true ) ) ;
1563
1619
const key = yield utils . getInput ( 'key' , true ) ;
1564
1620
const script_path = path . join ( __dirname , '../src/extensions.sh' ) ;
1565
1621
yield exec_1 . exec ( 'bash ' + script_path + ' "' + extensions + '" ' + key + ' ' + version ) ;
@@ -1597,8 +1653,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
1597
1653
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
1598
1654
} ) ;
1599
1655
} ;
1656
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1657
+ if ( mod && mod . __esModule ) return mod ;
1658
+ var result = { } ;
1659
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1660
+ result [ "default" ] = mod ;
1661
+ return result ;
1662
+ } ;
1600
1663
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1601
- const tr = __webpack_require__ ( 9 ) ;
1664
+ const tr = __importStar ( __webpack_require__ ( 9 ) ) ;
1602
1665
/**
1603
1666
* Exec a command.
1604
1667
* Output will be streamed to the live console.
0 commit comments