Skip to content

Commit

Permalink
fix: use single quotes to prevent bash command substitution (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored Jan 17, 2021
1 parent 331a0e9 commit cb1cc67
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function main() {

core.debug(`Local changes found`);

await runShellCommand(`git checkout -b "${TEMPORARY_BRANCH_NAME}"`);
await runShellCommand(`git checkout -b '${TEMPORARY_BRANCH_NAME}'`);

const gitUser = await getGitUser();
if (gitUser) {
Expand Down Expand Up @@ -104,7 +104,7 @@ async function main() {
}

await runShellCommand(
`git commit -m "${inputs.commitMessage}" --author "${inputs.author}"`
`git commit -m '${inputs.commitMessage}' --author '${inputs.author}'`
);

const currentBranch = await runShellCommand(
Expand All @@ -119,7 +119,7 @@ async function main() {
`git fetch https://x-access-token:${process.env.GITHUB_TOKEN}@github.com/${process.env.GITHUB_REPOSITORY}.git ${DEFAULT_BRANCH}:${DEFAULT_BRANCH}`
);
await runShellCommand(`git stash --include-untracked`);
await runShellCommand(`git rebase -X theirs "${DEFAULT_BRANCH}"`);
await runShellCommand(`git rebase -X theirs '${DEFAULT_BRANCH}'`);
}

core.debug(`Try to fetch and checkout remote branch "${inputs.branch}"`);
Expand Down Expand Up @@ -220,10 +220,10 @@ async function getGitUser() {

async function setGitUser({ name, email }) {
core.debug(`Configuring user.name as "${name}"`);
await runShellCommand(`git config --global user.name "${name}"`);
await runShellCommand(`git config --global user.name '${name}'`);

core.debug(`Configuring user.email as "${email}"`);
await runShellCommand(`git config --global user.email "${email}"`);
await runShellCommand(`git config --global user.email '${email}'`);
}

async function checkOutRemoteBranch(branch) {
Expand Down

0 comments on commit cb1cc67

Please sign in to comment.