feat: enhance error handling and working directory resolution (#1859)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
bc46e4c422
commit
a60bf3759e
4
dist/index.js
generated
vendored
4
dist/index.js
generated
vendored
@ -1838,7 +1838,7 @@ function run() {
|
||||
const inputs = (0, inputs_1.getInputs)();
|
||||
core.debug(`Inputs: ${JSON.stringify(inputs, null, 2)}`);
|
||||
core.debug(`Github Context: ${JSON.stringify(github.context, null, 2)}`);
|
||||
const workingDirectory = path_1.default.resolve(env.GITHUB_WORKSPACE || process.cwd(), inputs.path);
|
||||
const workingDirectory = path_1.default.resolve(env.GITHUB_WORKSPACE || process.cwd(), inputs.useRestApi ? '.' : inputs.path);
|
||||
core.debug(`Working directory: ${workingDirectory}`);
|
||||
const hasGitDirectory = yield (0, utils_1.hasLocalGitDirectory)({ workingDirectory });
|
||||
core.debug(`Has git directory: ${hasGitDirectory}`);
|
||||
@ -1874,7 +1874,7 @@ function run() {
|
||||
else {
|
||||
if (!hasGitDirectory) {
|
||||
core.info(`Running on a ${github.context.eventName} event...`);
|
||||
throw new Error("Can't find local .git directory. Please run actions/checkout before this action (Make sure the path specified in 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(`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.`);
|
||||
}
|
||||
core.info('Using local .git directory');
|
||||
yield getChangedFilesFromLocalGitHistory({
|
||||
|
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
@ -225,7 +225,7 @@ export async function run(): Promise<void> {
|
||||
|
||||
const workingDirectory = path.resolve(
|
||||
env.GITHUB_WORKSPACE || process.cwd(),
|
||||
inputs.path
|
||||
inputs.useRestApi ? '.' : inputs.path
|
||||
)
|
||||
core.debug(`Working directory: ${workingDirectory}`)
|
||||
|
||||
@ -271,7 +271,7 @@ export async function run(): Promise<void> {
|
||||
if (!hasGitDirectory) {
|
||||
core.info(`Running on a ${github.context.eventName} event...`)
|
||||
throw new Error(
|
||||
"Can't find local .git directory. Please run actions/checkout before this action (Make sure the path specified in the 'path' input is correct). If you intend to use Github's REST API note that only pull_request* events are supported."
|
||||
`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.`
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user