Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error using current path to determine the .git dir location #1299

20 changes: 17 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

25 changes: 23 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,24 @@
return stdout.trim()
}

export const isInsideWorkTree = async ({
cwd
}: {
cwd: string
}): Promise<string> => {
const {stdout} = await exec.getExecOutput(
'git',
['rev-parse', '--is-inside-work-tree'],
{
cwd,
ignoreReturnCode: true,
silent: !core.isDebug()
}
)

return stdout.trim() === "true"

Check failure on line 570 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Type 'boolean' is not assignable to type 'string'.
jackton1 marked this conversation as resolved.
Show resolved Hide resolved
jackton1 marked this conversation as resolved.
Show resolved Hide resolved
}

export const getRemoteBranchHeadSha = async ({
cwd,
branch
Expand Down Expand Up @@ -1103,6 +1121,9 @@
}: {
workingDirectory: string
}): Promise<boolean> => {
const gitDirectory = path.join(workingDirectory, '.git')
return await exists(gitDirectory)
const insideWorkTree = await isInsideWorkTree({
cwd: workingDirectory
})

return insideWorkTree

Check failure on line 1128 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Type 'string' is not assignable to type 'boolean'.
}