From ac0c8494b2015c77b35e431c12c9cc43d8e4256d Mon Sep 17 00:00:00 2001 From: Russell Bicknell Date: Mon, 14 Mar 2022 13:22:40 -0700 Subject: [PATCH 1/2] Change directory to `cwd` before running git user setup. --- .changeset/old-socks-unite.md | 5 +++++ src/index.ts | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .changeset/old-socks-unite.md diff --git a/.changeset/old-socks-unite.md b/.changeset/old-socks-unite.md new file mode 100644 index 00000000..203f22b6 --- /dev/null +++ b/.changeset/old-socks-unite.md @@ -0,0 +1,5 @@ +--- +"@changesets/action": patch +--- + +Change directory to `cwd` before running git user setup. diff --git a/src/index.ts b/src/index.ts index 2428f3bc..c1ae29b3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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) { @@ -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"); From 3c763497f8838358eb146f0954c16ee413770993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Tue, 15 Mar 2022 15:06:36 +0100 Subject: [PATCH 2/2] Update .changeset/old-socks-unite.md --- .changeset/old-socks-unite.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/old-socks-unite.md b/.changeset/old-socks-unite.md index 203f22b6..6555673f 100644 --- a/.changeset/old-socks-unite.md +++ b/.changeset/old-socks-unite.md @@ -2,4 +2,4 @@ "@changesets/action": patch --- -Change directory to `cwd` before running git user setup. +Change directory to `cwd` before running git user setup. This fixes an issue when the action starts its execution not in a git repository.