Execute piped command and deploy command generation

This commit is contained in:
Andreas Svanberg 2024-10-16 13:56:43 +02:00
parent 8dc32f57e9
commit 8a45006880
2 changed files with 9 additions and 6 deletions

7
dist/index.js vendored

@ -85,9 +85,10 @@ function main() {
const sshKey = core.getInput('ssh-key', { required: true });
core.info(`sshKey: ${sshKey.length}`);
fs.writeFileSync('ssh_key', sshKey, { flag: 'w+', mode: "0600" });
const result = yield exec.getExecOutput('cat', ['ssh_key']);
const sshKeyContents = result.stdout;
core.info(`sshKeyContents: ${sshKeyContents.length}`);
const pipedCommand = `pwd | ls`;
yield exec.exec('sh', ['-c', `${pipedCommand}`]);
const deployCommand = `echo "${gitea.context.serverUrl}/${gitea.context.repo.owner}/${gitea.context.repo.repo}.git ${process.env.GITHUB_REF_NAME}"`;
core.info(deployCommand);
});
}
main().catch(handleError);

@ -52,9 +52,11 @@ async function main() {
core.info(`sshKey: ${sshKey.length}`);
fs.writeFileSync('ssh_key', sshKey, {flag: 'w+', mode: "0600"});
const result = await exec.getExecOutput('cat', ['ssh_key']);
const sshKeyContents = result.stdout;
core.info(`sshKeyContents: ${sshKeyContents.length}`);
const pipedCommand = `pwd | ls`;
await exec.exec('sh', ['-c', `${pipedCommand}`]);
const deployCommand = `echo "${gitea.context.serverUrl}/${gitea.context.repo.owner}/${gitea.context.repo.repo}.git ${process.env.GITHUB_REF_NAME}"`;
core.info(deployCommand);
}
main().catch(handleError);