From 6ea29d2e6e2aa0611807192f06021f019678cf48 Mon Sep 17 00:00:00 2001 From: Dario Dorando Date: Wed, 6 Sep 2023 15:09:13 +0300 Subject: [PATCH] make logging ACTUALLY work --- src/create-pull-request.ts | 5 ++++- src/main.ts | 5 ++++- src/utils.ts | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/create-pull-request.ts b/src/create-pull-request.ts index bf5eb9c..d511a1c 100644 --- a/src/create-pull-request.ts +++ b/src/create-pull-request.ts @@ -265,7 +265,10 @@ export async function createPullRequest(inputs: Inputs): Promise { } } } catch (error) { - console.log(error) + if (error instanceof Error) { + core.error(error) + if (error.stack) core.error(error.stack) + } core.setFailed(utils.getErrorMessage(error)) } finally { // Remove auth and restore persisted auth config if it existed diff --git a/src/main.ts b/src/main.ts index c6db73c..9be7c90 100644 --- a/src/main.ts +++ b/src/main.ts @@ -32,7 +32,10 @@ async function run(): Promise { await createPullRequest(inputs) } catch (error) { - console.error(error) + if (error instanceof Error) { + core.error(error) + if (error.stack) core.error(error.stack) + } core.setFailed(utils.getErrorMessage(error)) } } diff --git a/src/utils.ts b/src/utils.ts index 92ba36c..c8bacc5 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -147,8 +147,8 @@ export function fileExistsSync(path: string): boolean { throw new Error("Arg 'path' must not be empty") } - console.log(path) - console.log(fs.realpathSync(path)) + core.info(path) + core.info(fs.realpathSync(path)) let stats: fs.Stats try {