Skip to content

Commit 52c9ce7

Browse files
authored
Change directory to cwd before running git user setup. (#161)
1 parent b0aaf6a commit 52c9ce7

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.changeset/old-socks-unite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/action": patch
3+
---
4+
5+
Change directory to `cwd` before running git user setup. This fixes an issue when the action starts its execution not in a git repository.

src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
1414
return;
1515
}
1616

17+
const inputCwd = core.getInput("cwd");
18+
if (inputCwd) {
19+
console.log("changing directory to the one given as the input");
20+
process.chdir(inputCwd);
21+
}
22+
1723
let setupGitUser = core.getBooleanInput("setupGitUser");
1824

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

30-
const inputCwd = core.getInput("cwd");
31-
if (inputCwd) {
32-
console.log("changing directory to the one given as the input");
33-
process.chdir(inputCwd);
34-
}
35-
3636
let { changesets } = await readChangesetState();
3737

3838
let publishScript = core.getInput("publish");

0 commit comments

Comments
 (0)