feat: enhance error handling for non-git directories (#1885)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
6
dist/index.js
generated
vendored
6
dist/index.js
generated
vendored
@@ -1868,8 +1868,7 @@ function run() {
|
||||
}
|
||||
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.`);
|
||||
throw new Error(`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}".`);
|
||||
}
|
||||
core.info('Using local .git directory');
|
||||
yield getChangedFilesFromLocalGitHistory({
|
||||
@@ -2457,6 +2456,9 @@ const isInsideWorkTree = ({ cwd }) => __awaiter(void 0, void 0, void 0, function
|
||||
ignoreReturnCode: true,
|
||||
silent: !core.isDebug()
|
||||
});
|
||||
if (stdout.trim() !== 'true') {
|
||||
core.debug(`The current working directory is not inside a git repository: ${cwd}`);
|
||||
}
|
||||
return stdout.trim() === 'true';
|
||||
});
|
||||
exports.isInsideWorkTree = isInsideWorkTree;
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user