feat: enhance error handling for non-git directories (#1885)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
@@ -264,9 +264,8 @@ export async function run(): Promise<void> {
|
||||
})
|
||||
} else {
|
||||
if (!hasGitDirectory) {
|
||||
core.info(`Running on a ${github.context.eventName} event...`)
|
||||
throw new Error(
|
||||
`Can't find local .git in ${workingDirectory} directory. Please run actions/checkout before this action (Make sure the 'path' input is correct). If you intend to use Github's REST API note that only pull_request* events are supported.`
|
||||
`Unable to locate the git repository in the given path: ${workingDirectory}.\n Please run actions/checkout before this action (Make sure the 'path' input is correct).\n If you intend to use Github's REST API note that only pull_request* events are supported. Current event is "${github.context.eventName}".`
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -680,6 +680,12 @@ export const isInsideWorkTree = async ({
|
||||
}
|
||||
)
|
||||
|
||||
if (stdout.trim() !== 'true') {
|
||||
core.debug(
|
||||
`The current working directory is not inside a git repository: ${cwd}`
|
||||
)
|
||||
}
|
||||
|
||||
return stdout.trim() === 'true'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user