@@ -292,14 +292,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
292
292
return result ;
293
293
} ;
294
294
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
295
- exports . prepareKeyValueMessage = exports . issueFileCommand = void 0 ;
295
+ exports . issueCommand = void 0 ;
296
296
// We use any as a valid input type
297
297
/* eslint-disable @typescript-eslint/no-explicit-any */
298
298
const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
299
299
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
300
- const uuid_1 = __webpack_require__ ( 62 ) ;
301
300
const utils_1 = __webpack_require__ ( 82 ) ;
302
- function issueFileCommand ( command , message ) {
301
+ function issueCommand ( command , message ) {
303
302
const filePath = process . env [ `GITHUB_${ command } ` ] ;
304
303
if ( ! filePath ) {
305
304
throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
@@ -311,22 +310,7 @@ function issueFileCommand(command, message) {
311
310
encoding : 'utf8'
312
311
} ) ;
313
312
}
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 ;
330
314
//# sourceMappingURL=file-command.js.map
331
315
332
316
/***/ } ) ,
@@ -338,20 +322,12 @@ const core = __webpack_require__(470);
338
322
const child_process = __webpack_require__ ( 129 ) ;
339
323
const fs = __webpack_require__ ( 747 ) ;
340
324
const crypto = __webpack_require__ ( 417 ) ;
341
- const { homePath, sshAgentCmdDefault , sshAddCmdDefault , gitCmdDefault } = __webpack_require__ ( 972 ) ;
325
+ const { homePath, sshAgentCmd , sshAddCmd , gitCmd } = __webpack_require__ ( 972 ) ;
342
326
343
327
try {
344
328
const privateKey = core . getInput ( 'ssh-private-key' ) ;
345
329
const logPublicKey = core . getBooleanInput ( 'log-public-key' , { default : true } ) ;
346
330
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
-
355
331
if ( ! privateKey ) {
356
332
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." ) ;
357
333
@@ -1765,6 +1741,7 @@ const file_command_1 = __webpack_require__(102);
1765
1741
const utils_1 = __webpack_require__ ( 82 ) ;
1766
1742
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1767
1743
const path = __importStar ( __webpack_require__ ( 622 ) ) ;
1744
+ const uuid_1 = __webpack_require__ ( 62 ) ;
1768
1745
const oidc_utils_1 = __webpack_require__ ( 742 ) ;
1769
1746
/**
1770
1747
* The code to exit an action
@@ -1794,9 +1771,20 @@ function exportVariable(name, val) {
1794
1771
process . env [ name ] = convertedVal ;
1795
1772
const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
1796
1773
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 ) ;
1798
1787
}
1799
- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
1800
1788
}
1801
1789
exports . exportVariable = exportVariable ;
1802
1790
/**
@@ -1814,7 +1802,7 @@ exports.setSecret = setSecret;
1814
1802
function addPath ( inputPath ) {
1815
1803
const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
1816
1804
if ( filePath ) {
1817
- file_command_1 . issueFileCommand ( 'PATH' , inputPath ) ;
1805
+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
1818
1806
}
1819
1807
else {
1820
1808
command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
@@ -1854,10 +1842,7 @@ function getMultilineInput(name, options) {
1854
1842
const inputs = getInput ( name , options )
1855
1843
. split ( '\n' )
1856
1844
. filter ( x => x !== '' ) ;
1857
- if ( options && options . trimWhitespace === false ) {
1858
- return inputs ;
1859
- }
1860
- return inputs . map ( input => input . trim ( ) ) ;
1845
+ return inputs ;
1861
1846
}
1862
1847
exports . getMultilineInput = getMultilineInput ;
1863
1848
/**
@@ -1890,12 +1875,8 @@ exports.getBooleanInput = getBooleanInput;
1890
1875
*/
1891
1876
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1892
1877
function 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
- }
1897
1878
process . stdout . write ( os . EOL ) ;
1898
- command_1 . issueCommand ( 'set-output' , { name } , utils_1 . toCommandValue ( value ) ) ;
1879
+ command_1 . issueCommand ( 'set-output' , { name } , value ) ;
1899
1880
}
1900
1881
exports . setOutput = setOutput ;
1901
1882
/**
@@ -2024,11 +2005,7 @@ exports.group = group;
2024
2005
*/
2025
2006
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2026
2007
function 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 ) ;
2032
2009
}
2033
2010
exports . saveState = saveState ;
2034
2011
/**
@@ -2918,8 +2895,9 @@ exports.default = _default;
2918
2895
/***/ ( function ( module , __unusedexports , __webpack_require__ ) {
2919
2896
2920
2897
const os = __webpack_require__ ( 87 ) ;
2898
+ const core = __webpack_require__ ( 470 ) ;
2921
2899
2922
- module . exports = ( process . env [ 'OS' ] != 'Windows_NT' ) ? {
2900
+ const defaults = ( process . env [ 'OS' ] != 'Windows_NT' ) ? {
2923
2901
// Use getent() system call, since this is what ssh does; makes a difference in Docker-based
2924
2902
// Action runs, where $HOME is different from the pwent
2925
2903
homePath : os . userInfo ( ) . homedir ,
@@ -2934,6 +2912,17 @@ module.exports = (process.env['OS'] != 'Windows_NT') ? {
2934
2912
gitCmdDefault : 'c://progra~1//git//bin//git.exe'
2935
2913
} ;
2936
2914
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
+
2937
2926
2938
2927
/***/ } )
2939
2928
0 commit comments