diff --git a/dist/index.js b/dist/index.js index 371a9ece..54befbe5 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/index.js.map b/dist/index.js.map index 00915287..b0aa2a6d 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/src/utils.ts b/src/utils.ts index 762ef952..041b11db 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -552,6 +552,24 @@ export const getHeadSha = async ({cwd}: {cwd: string}): Promise => { return stdout.trim() } +export const isInsideWorkTree = async ({ + cwd +}: { + cwd: string +}): Promise => { + const {stdout} = await exec.getExecOutput( + 'git', + ['rev-parse', '--is-inside-work-tree'], + { + cwd, + ignoreReturnCode: true, + silent: !core.isDebug() + } + ) + + return stdout.trim() === 'true' +} + export const getRemoteBranchHeadSha = async ({ cwd, branch @@ -1103,6 +1121,9 @@ export const hasLocalGitDirectory = async ({ }: { workingDirectory: string }): Promise => { - const gitDirectory = path.join(workingDirectory, '.git') - return await exists(gitDirectory) + const insideWorkTree = await isInsideWorkTree({ + cwd: workingDirectory + }) + + return insideWorkTree }