Skip to content

Commit

Permalink
Change directory to cwd before running git user setup. (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
bicknellr committed Mar 15, 2022
1 parent b0aaf6a commit 52c9ce7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-socks-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/action": patch
---

Change directory to `cwd` before running git user setup. This fixes an issue when the action starts its execution not in a git repository.
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
return;
}

const inputCwd = core.getInput("cwd");
if (inputCwd) {
console.log("changing directory to the one given as the input");
process.chdir(inputCwd);
}

let setupGitUser = core.getBooleanInput("setupGitUser");

if (setupGitUser) {
Expand All @@ -27,12 +33,6 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
`machine github.com\nlogin github-actions[bot]\npassword ${githubToken}`
);

const inputCwd = core.getInput("cwd");
if (inputCwd) {
console.log("changing directory to the one given as the input");
process.chdir(inputCwd);
}

let { changesets } = await readChangesetState();

let publishScript = core.getInput("publish");
Expand Down

0 comments on commit 52c9ce7

Please sign in to comment.