@@ -292,14 +292,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
292292 return result ;
293293} ;
294294Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
295- exports . prepareKeyValueMessage = exports . issueFileCommand = void 0 ;
295+ exports . issueCommand = void 0 ;
296296// We use any as a valid input type
297297/* eslint-disable @typescript-eslint/no-explicit-any */
298298const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
299299const os = __importStar ( __webpack_require__ ( 87 ) ) ;
300- const uuid_1 = __webpack_require__ ( 62 ) ;
301300const utils_1 = __webpack_require__ ( 82 ) ;
302- function issueFileCommand ( command , message ) {
301+ function issueCommand ( command , message ) {
303302 const filePath = process . env [ `GITHUB_${ command } ` ] ;
304303 if ( ! filePath ) {
305304 throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
@@ -311,22 +310,7 @@ function issueFileCommand(command, message) {
311310 encoding : 'utf8'
312311 } ) ;
313312}
314- exports . issueFileCommand = issueFileCommand ;
315- function prepareKeyValueMessage ( key , value ) {
316- const delimiter = `ghadelimiter_${ uuid_1 . v4 ( ) } ` ;
317- const convertedValue = utils_1 . toCommandValue ( value ) ;
318- // These should realistically never happen, but just in case someone finds a
319- // way to exploit uuid generation let's not allow keys or values that contain
320- // the delimiter.
321- if ( key . includes ( delimiter ) ) {
322- throw new Error ( `Unexpected input: name should not contain the delimiter "${ delimiter } "` ) ;
323- }
324- if ( convertedValue . includes ( delimiter ) ) {
325- throw new Error ( `Unexpected input: value should not contain the delimiter "${ delimiter } "` ) ;
326- }
327- return `${ key } <<${ delimiter } ${ os . EOL } ${ convertedValue } ${ os . EOL } ${ delimiter } ` ;
328- }
329- exports . prepareKeyValueMessage = prepareKeyValueMessage ;
313+ exports . issueCommand = issueCommand ;
330314//# sourceMappingURL=file-command.js.map
331315
332316/***/ } ) ,
@@ -338,20 +322,12 @@ const core = __webpack_require__(470);
338322const child_process = __webpack_require__ ( 129 ) ;
339323const fs = __webpack_require__ ( 747 ) ;
340324const crypto = __webpack_require__ ( 417 ) ;
341- const { homePath, sshAgentCmdDefault , sshAddCmdDefault , gitCmdDefault } = __webpack_require__ ( 972 ) ;
325+ const { homePath, sshAgentCmd , sshAddCmd , gitCmd } = __webpack_require__ ( 972 ) ;
342326
343327try {
344328 const privateKey = core . getInput ( 'ssh-private-key' ) ;
345329 const logPublicKey = core . getBooleanInput ( 'log-public-key' , { default : true } ) ;
346330
347- const sshAgentCmdInput = core . getInput ( 'ssh-agent-cmd' ) ;
348- const sshAddCmdInput = core . getInput ( 'ssh-add-cmd' ) ;
349- const gitCmdInput = core . getInput ( 'git-cmd' ) ;
350-
351- const sshAgentCmd = sshAgentCmdInput ? sshAgentCmdInput : sshAgentCmdDefault ;
352- const sshAddCmd = sshAddCmdInput ? sshAddCmdInput : sshAddCmdDefault ;
353- const gitCmd = gitCmdInput ? gitCmdInput : gitCmdDefault ;
354-
355331 if ( ! privateKey ) {
356332 core . setFailed ( "The ssh-private-key argument is empty. Maybe the secret has not been configured, or you are using a wrong secret name in your workflow file." ) ;
357333
@@ -1765,6 +1741,7 @@ const file_command_1 = __webpack_require__(102);
17651741const utils_1 = __webpack_require__ ( 82 ) ;
17661742const os = __importStar ( __webpack_require__ ( 87 ) ) ;
17671743const path = __importStar ( __webpack_require__ ( 622 ) ) ;
1744+ const uuid_1 = __webpack_require__ ( 62 ) ;
17681745const oidc_utils_1 = __webpack_require__ ( 742 ) ;
17691746/**
17701747 * The code to exit an action
@@ -1794,9 +1771,20 @@ function exportVariable(name, val) {
17941771 process . env [ name ] = convertedVal ;
17951772 const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
17961773 if ( filePath ) {
1797- return file_command_1 . issueFileCommand ( 'ENV' , file_command_1 . prepareKeyValueMessage ( name , val ) ) ;
1774+ const delimiter = `ghadelimiter_${ uuid_1 . v4 ( ) } ` ;
1775+ // These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
1776+ if ( name . includes ( delimiter ) ) {
1777+ throw new Error ( `Unexpected input: name should not contain the delimiter "${ delimiter } "` ) ;
1778+ }
1779+ if ( convertedVal . includes ( delimiter ) ) {
1780+ throw new Error ( `Unexpected input: value should not contain the delimiter "${ delimiter } "` ) ;
1781+ }
1782+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
1783+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
1784+ }
1785+ else {
1786+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
17981787 }
1799- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
18001788}
18011789exports . exportVariable = exportVariable ;
18021790/**
@@ -1814,7 +1802,7 @@ exports.setSecret = setSecret;
18141802function addPath ( inputPath ) {
18151803 const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
18161804 if ( filePath ) {
1817- file_command_1 . issueFileCommand ( 'PATH' , inputPath ) ;
1805+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
18181806 }
18191807 else {
18201808 command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
@@ -1854,10 +1842,7 @@ function getMultilineInput(name, options) {
18541842 const inputs = getInput ( name , options )
18551843 . split ( '\n' )
18561844 . filter ( x => x !== '' ) ;
1857- if ( options && options . trimWhitespace === false ) {
1858- return inputs ;
1859- }
1860- return inputs . map ( input => input . trim ( ) ) ;
1845+ return inputs ;
18611846}
18621847exports . getMultilineInput = getMultilineInput ;
18631848/**
@@ -1890,12 +1875,8 @@ exports.getBooleanInput = getBooleanInput;
18901875 */
18911876// eslint-disable-next-line @typescript-eslint/no-explicit-any
18921877function setOutput ( name , value ) {
1893- const filePath = process . env [ 'GITHUB_OUTPUT' ] || '' ;
1894- if ( filePath ) {
1895- return file_command_1 . issueFileCommand ( 'OUTPUT' , file_command_1 . prepareKeyValueMessage ( name , value ) ) ;
1896- }
18971878 process . stdout . write ( os . EOL ) ;
1898- command_1 . issueCommand ( 'set-output' , { name } , utils_1 . toCommandValue ( value ) ) ;
1879+ command_1 . issueCommand ( 'set-output' , { name } , value ) ;
18991880}
19001881exports . setOutput = setOutput ;
19011882/**
@@ -2024,11 +2005,7 @@ exports.group = group;
20242005 */
20252006// eslint-disable-next-line @typescript-eslint/no-explicit-any
20262007function saveState ( name , value ) {
2027- const filePath = process . env [ 'GITHUB_STATE' ] || '' ;
2028- if ( filePath ) {
2029- return file_command_1 . issueFileCommand ( 'STATE' , file_command_1 . prepareKeyValueMessage ( name , value ) ) ;
2030- }
2031- command_1 . issueCommand ( 'save-state' , { name } , utils_1 . toCommandValue ( value ) ) ;
2008+ command_1 . issueCommand ( 'save-state' , { name } , value ) ;
20322009}
20332010exports . saveState = saveState ;
20342011/**
@@ -2918,8 +2895,9 @@ exports.default = _default;
29182895/***/ ( function ( module , __unusedexports , __webpack_require__ ) {
29192896
29202897const os = __webpack_require__ ( 87 ) ;
2898+ const core = __webpack_require__ ( 470 ) ;
29212899
2922- module . exports = ( process . env [ 'OS' ] != 'Windows_NT' ) ? {
2900+ const defaults = ( process . env [ 'OS' ] != 'Windows_NT' ) ? {
29232901 // Use getent() system call, since this is what ssh does; makes a difference in Docker-based
29242902 // Action runs, where $HOME is different from the pwent
29252903 homePath : os . userInfo ( ) . homedir ,
@@ -2934,6 +2912,17 @@ module.exports = (process.env['OS'] != 'Windows_NT') ? {
29342912 gitCmdDefault : 'c://progra~1//git//bin//git.exe'
29352913} ;
29362914
2915+ const sshAgentCmdInput = core . getInput ( 'ssh-agent-cmd' ) ;
2916+ const sshAddCmdInput = core . getInput ( 'ssh-add-cmd' ) ;
2917+ const gitCmdInput = core . getInput ( 'git-cmd' ) ;
2918+
2919+ module . exports = {
2920+ homePath : defaults . homePath ,
2921+ sshAgentCmd : sshAgentCmdInput !== '' ? sshAgentCmdInput : defaults . sshAgentCmdDefault ,
2922+ sshAddCmd : sshAddCmdInput !== '' ? sshAddCmdInput : defaults . sshAddCmdDefault ,
2923+ gitCmd : gitCmdInput !== '' ? gitCmdInput : defaults . gitCmdDefault ,
2924+ } ;
2925+
29372926
29382927/***/ } )
29392928
0 commit comments