@@ -43,13 +43,75 @@ module.exports =
4343/************************************************************************/
4444/******/ ( {
4545
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+
4672/***/ 87 :
4773/***/ ( function ( module ) {
4874
4975module . exports = require ( "os" ) ;
5076
5177/***/ } ) ,
5278
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+
53115/***/ 104 :
54116/***/ ( function ( __unusedmodule , __unusedexports , __webpack_require__ ) {
55117
92154 writeFileSync ( cfg_path , cfg , "utf8" ) ;
93155 exec ( `net start fdbmonitor` ) ;
94156 exec ( `"C:\\Program Files\\foundationdb\\bin\\fdbcli.exe" --exec "configure new single ssd"` ) ;
95- console . log ( "::add-path:: C:\\Program Files\\foundationdb\\bin") ;
157+ core . addPath ( " C:\\Program Files\\foundationdb\\bin") ;
96158 break ;
97159 }
98160 case 'darwin' : {
@@ -122,17 +184,25 @@ module.exports = require("child_process");
122184
123185"use strict" ;
124186
187+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
188+ if ( mod && mod . __esModule ) return mod ;
189+ var result = { } ;
190+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
191+ result [ "default" ] = mod ;
192+ return result ;
193+ } ;
125194Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
126- const os = __webpack_require__ ( 87 ) ;
195+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
196+ const utils_1 = __webpack_require__ ( 82 ) ;
127197/**
128198 * Commands
129199 *
130200 * Command Format:
131- * ##[ name key=value; key=value] message
201+ * :: name key=value, key=value:: message
132202 *
133203 * Examples:
134- * ##[ warning] This is the user warning message
135- * ##[ set-secret name=mypassword]definitelyNotAPassword!
204+ * :: warning:: This is the message
205+ * :: set-env name=MY_VAR::some value
136206 */
137207function issueCommand ( command , properties , message ) {
138208 const cmd = new Command ( command , properties , message ) ;
@@ -168,30 +238,28 @@ class Command {
168238 else {
169239 cmdStr += ',' ;
170240 }
171- // safely append the val - avoid blowing up when attempting to
172- // call .replace() if message is not a string for some reason
173- cmdStr += `${ key } =${ escape ( `${ val || '' } ` ) } ` ;
241+ cmdStr += `${ key } =${ escapeProperty ( val ) } ` ;
174242 }
175243 }
176244 }
177245 }
178- cmdStr += CMD_STRING ;
179- // safely append the message - avoid blowing up when attempting to
180- // call .replace() if message is not a string for some reason
181- const message = `${ this . message || '' } ` ;
182- cmdStr += escapeData ( message ) ;
246+ cmdStr += `${ CMD_STRING } ${ escapeData ( this . message ) } ` ;
183247 return cmdStr ;
184248 }
185249}
186250function escapeData ( s ) {
187- return s . replace ( / \r / g, '%0D' ) . replace ( / \n / g, '%0A' ) ;
251+ return utils_1 . toCommandValue ( s )
252+ . replace ( / % / g, '%25' )
253+ . replace ( / \r / g, '%0D' )
254+ . replace ( / \n / g, '%0A' ) ;
188255}
189- function escape ( s ) {
190- return s
256+ function escapeProperty ( s ) {
257+ return utils_1 . toCommandValue ( s )
258+ . replace ( / % / g, '%25' )
191259 . replace ( / \r / g, '%0D' )
192260 . replace ( / \n / g, '%0A' )
193- . replace ( / ] / g, '%5D ' )
194- . replace ( / ; / g, '%3B ' ) ;
261+ . replace ( / : / g, '%3A ' )
262+ . replace ( / , / g, '%2C ' ) ;
195263}
196264//# sourceMappingURL=command.js.map
197265
@@ -211,10 +279,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
211279 step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
212280 } ) ;
213281} ;
282+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
283+ if ( mod && mod . __esModule ) return mod ;
284+ var result = { } ;
285+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
286+ result [ "default" ] = mod ;
287+ return result ;
288+ } ;
214289Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
215290const command_1 = __webpack_require__ ( 431 ) ;
216- const os = __webpack_require__ ( 87 ) ;
217- const path = __webpack_require__ ( 622 ) ;
291+ const file_command_1 = __webpack_require__ ( 102 ) ;
292+ const utils_1 = __webpack_require__ ( 82 ) ;
293+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
294+ const path = __importStar ( __webpack_require__ ( 622 ) ) ;
218295/**
219296 * The code to exit an action
220297 */
@@ -235,11 +312,21 @@ var ExitCode;
235312/**
236313 * Sets env variable for this action and future actions in the job
237314 * @param name the name of the variable to set
238- * @param val the value of the variable
315+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
239316 */
317+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
240318function exportVariable ( name , val ) {
241- process . env [ name ] = val ;
242- command_1 . issueCommand ( 'set-env' , { name } , val ) ;
319+ const convertedVal = utils_1 . toCommandValue ( val ) ;
320+ process . env [ name ] = convertedVal ;
321+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
322+ if ( filePath ) {
323+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
324+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
325+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
326+ }
327+ else {
328+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
329+ }
243330}
244331exports . exportVariable = exportVariable ;
245332/**
@@ -255,7 +342,13 @@ exports.setSecret = setSecret;
255342 * @param inputPath
256343 */
257344function addPath ( inputPath ) {
258- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
345+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
346+ if ( filePath ) {
347+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
348+ }
349+ else {
350+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
351+ }
259352 process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
260353}
261354exports . addPath = addPath ;
@@ -278,12 +371,22 @@ exports.getInput = getInput;
278371 * Sets the value of an output.
279372 *
280373 * @param name name of the output to set
281- * @param value value to store
374+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
282375 */
376+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
283377function setOutput ( name , value ) {
284378 command_1 . issueCommand ( 'set-output' , { name } , value ) ;
285379}
286380exports . setOutput = setOutput ;
381+ /**
382+ * Enables or disables the echoing of commands into stdout for the rest of the step.
383+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
384+ *
385+ */
386+ function setCommandEcho ( enabled ) {
387+ command_1 . issue ( 'echo' , enabled ? 'on' : 'off' ) ;
388+ }
389+ exports . setCommandEcho = setCommandEcho ;
287390//-----------------------------------------------------------------------
288391// Results
289392//-----------------------------------------------------------------------
@@ -300,6 +403,13 @@ exports.setFailed = setFailed;
300403//-----------------------------------------------------------------------
301404// Logging Commands
302405//-----------------------------------------------------------------------
406+ /**
407+ * Gets whether Actions Step Debug is on or not
408+ */
409+ function isDebug ( ) {
410+ return process . env [ 'RUNNER_DEBUG' ] === '1' ;
411+ }
412+ exports . isDebug = isDebug ;
303413/**
304414 * Writes debug message to user log
305415 * @param message debug message
@@ -310,18 +420,18 @@ function debug(message) {
310420exports . debug = debug ;
311421/**
312422 * Adds an error issue
313- * @param message error issue message
423+ * @param message error issue message. Errors will be converted to string via toString()
314424 */
315425function error ( message ) {
316- command_1 . issue ( 'error' , message ) ;
426+ command_1 . issue ( 'error' , message instanceof Error ? message . toString ( ) : message ) ;
317427}
318428exports . error = error ;
319429/**
320430 * Adds an warning issue
321- * @param message warning issue message
431+ * @param message warning issue message. Errors will be converted to string via toString()
322432 */
323433function warning ( message ) {
324- command_1 . issue ( 'warning' , message ) ;
434+ command_1 . issue ( 'warning' , message instanceof Error ? message . toString ( ) : message ) ;
325435}
326436exports . warning = warning ;
327437/**
@@ -379,8 +489,9 @@ exports.group = group;
379489 * Saves state for current action, the state can only be retrieved by this action's post job execution.
380490 *
381491 * @param name name of the state to store
382- * @param value value to store
492+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
383493 */
494+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
384495function saveState ( name , value ) {
385496 command_1 . issueCommand ( 'save-state' , { name } , value ) ;
386497}
0 commit comments