Skip to content

Commit e2e4a6e

Browse files
committed
Rebuild files in dist/
1 parent 7aec9dc commit e2e4a6e

File tree

2 files changed

+69
-84
lines changed

2 files changed

+69
-84
lines changed

dist/cleanup.js

+34-38
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
292292
return result;
293293
};
294294
Object.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 */
298298
const fs = __importStar(__webpack_require__(747));
299299
const os = __importStar(__webpack_require__(87));
300-
const uuid_1 = __webpack_require__(62);
301300
const 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
/***/ }),
@@ -613,7 +597,6 @@ exports.debug = debug; // for test
613597
/***/ 175:
614598
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
615599

616-
const core = __webpack_require__(470);
617600
const { execFileSync } = __webpack_require__(129);
618601
const { sshAgentCmd } = __webpack_require__(972);
619602

@@ -1684,6 +1667,7 @@ const file_command_1 = __webpack_require__(102);
16841667
const utils_1 = __webpack_require__(82);
16851668
const os = __importStar(__webpack_require__(87));
16861669
const path = __importStar(__webpack_require__(622));
1670+
const uuid_1 = __webpack_require__(62);
16871671
const oidc_utils_1 = __webpack_require__(742);
16881672
/**
16891673
* The code to exit an action
@@ -1713,9 +1697,20 @@ function exportVariable(name, val) {
17131697
process.env[name] = convertedVal;
17141698
const filePath = process.env['GITHUB_ENV'] || '';
17151699
if (filePath) {
1716-
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
1700+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
1701+
// 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.
1702+
if (name.includes(delimiter)) {
1703+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
1704+
}
1705+
if (convertedVal.includes(delimiter)) {
1706+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
1707+
}
1708+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
1709+
file_command_1.issueCommand('ENV', commandValue);
1710+
}
1711+
else {
1712+
command_1.issueCommand('set-env', { name }, convertedVal);
17171713
}
1718-
command_1.issueCommand('set-env', { name }, convertedVal);
17191714
}
17201715
exports.exportVariable = exportVariable;
17211716
/**
@@ -1733,7 +1728,7 @@ exports.setSecret = setSecret;
17331728
function addPath(inputPath) {
17341729
const filePath = process.env['GITHUB_PATH'] || '';
17351730
if (filePath) {
1736-
file_command_1.issueFileCommand('PATH', inputPath);
1731+
file_command_1.issueCommand('PATH', inputPath);
17371732
}
17381733
else {
17391734
command_1.issueCommand('add-path', {}, inputPath);
@@ -1773,10 +1768,7 @@ function getMultilineInput(name, options) {
17731768
const inputs = getInput(name, options)
17741769
.split('\n')
17751770
.filter(x => x !== '');
1776-
if (options && options.trimWhitespace === false) {
1777-
return inputs;
1778-
}
1779-
return inputs.map(input => input.trim());
1771+
return inputs;
17801772
}
17811773
exports.getMultilineInput = getMultilineInput;
17821774
/**
@@ -1809,12 +1801,8 @@ exports.getBooleanInput = getBooleanInput;
18091801
*/
18101802
// eslint-disable-next-line @typescript-eslint/no-explicit-any
18111803
function setOutput(name, value) {
1812-
const filePath = process.env['GITHUB_OUTPUT'] || '';
1813-
if (filePath) {
1814-
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
1815-
}
18161804
process.stdout.write(os.EOL);
1817-
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
1805+
command_1.issueCommand('set-output', { name }, value);
18181806
}
18191807
exports.setOutput = setOutput;
18201808
/**
@@ -1943,11 +1931,7 @@ exports.group = group;
19431931
*/
19441932
// eslint-disable-next-line @typescript-eslint/no-explicit-any
19451933
function saveState(name, value) {
1946-
const filePath = process.env['GITHUB_STATE'] || '';
1947-
if (filePath) {
1948-
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
1949-
}
1950-
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
1934+
command_1.issueCommand('save-state', { name }, value);
19511935
}
19521936
exports.saveState = saveState;
19531937
/**
@@ -2837,8 +2821,9 @@ exports.default = _default;
28372821
/***/ (function(module, __unusedexports, __webpack_require__) {
28382822

28392823
const os = __webpack_require__(87);
2824+
const core = __webpack_require__(470);
28402825

2841-
module.exports = (process.env['OS'] != 'Windows_NT') ? {
2826+
const defaults = (process.env['OS'] != 'Windows_NT') ? {
28422827
// Use getent() system call, since this is what ssh does; makes a difference in Docker-based
28432828
// Action runs, where $HOME is different from the pwent
28442829
homePath: os.userInfo().homedir,
@@ -2853,6 +2838,17 @@ module.exports = (process.env['OS'] != 'Windows_NT') ? {
28532838
gitCmdDefault: 'c://progra~1//git//bin//git.exe'
28542839
};
28552840

2841+
const sshAgentCmdInput = core.getInput('ssh-agent-cmd');
2842+
const sshAddCmdInput = core.getInput('ssh-add-cmd');
2843+
const gitCmdInput = core.getInput('git-cmd');
2844+
2845+
module.exports = {
2846+
homePath: defaults.homePath,
2847+
sshAgentCmd: sshAgentCmdInput !== '' ? sshAgentCmdInput : defaults.sshAgentCmdDefault,
2848+
sshAddCmd: sshAddCmdInput !== '' ? sshAddCmdInput : defaults.sshAddCmdDefault,
2849+
gitCmd: gitCmdInput !== '' ? gitCmdInput : defaults.gitCmdDefault,
2850+
};
2851+
28562852

28572853
/***/ })
28582854

dist/index.js

+35-46
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
292292
return result;
293293
};
294294
Object.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 */
298298
const fs = __importStar(__webpack_require__(747));
299299
const os = __importStar(__webpack_require__(87));
300-
const uuid_1 = __webpack_require__(62);
301300
const 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);
338322
const child_process = __webpack_require__(129);
339323
const fs = __webpack_require__(747);
340324
const crypto = __webpack_require__(417);
341-
const { homePath, sshAgentCmdDefault, sshAddCmdDefault, gitCmdDefault } = __webpack_require__(972);
325+
const { homePath, sshAgentCmd, sshAddCmd, gitCmd } = __webpack_require__(972);
342326

343327
try {
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);
17651741
const utils_1 = __webpack_require__(82);
17661742
const os = __importStar(__webpack_require__(87));
17671743
const path = __importStar(__webpack_require__(622));
1744+
const uuid_1 = __webpack_require__(62);
17681745
const 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
}
18011789
exports.exportVariable = exportVariable;
18021790
/**
@@ -1814,7 +1802,7 @@ exports.setSecret = setSecret;
18141802
function 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
}
18621847
exports.getMultilineInput = getMultilineInput;
18631848
/**
@@ -1890,12 +1875,8 @@ exports.getBooleanInput = getBooleanInput;
18901875
*/
18911876
// eslint-disable-next-line @typescript-eslint/no-explicit-any
18921877
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-
}
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
}
19001881
exports.setOutput = setOutput;
19011882
/**
@@ -2024,11 +2005,7 @@ exports.group = group;
20242005
*/
20252006
// eslint-disable-next-line @typescript-eslint/no-explicit-any
20262007
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);
20322009
}
20332010
exports.saveState = saveState;
20342011
/**
@@ -2918,8 +2895,9 @@ exports.default = _default;
29182895
/***/ (function(module, __unusedexports, __webpack_require__) {
29192896

29202897
const 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

Comments
 (0)