From e177917840a81d087aa802bafbef9e85be2a455a Mon Sep 17 00:00:00 2001 From: Rob Crowe Date: Wed, 10 Apr 2024 11:25:24 +0100 Subject: [PATCH] Save summary even if comment skipped Address PR comments: - Call saveSummary - Use getBooleanInput --- index.ts | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/index.ts b/index.ts index d0ec759..c60dfab 100644 --- a/index.ts +++ b/index.ts @@ -89,7 +89,7 @@ async function run() { try { const accessToken = core.getInput('access-token'); const limit = Number(core.getInput('limit')); - const skipComment = core.getInput('skip-comment') === 'true'; + const skipComment = core.getBooleanInput('skip-comment'); const slowThreshold = Number(core.getInput('slow-threshold')); const workspaceRoot = core.getInput('workspace-root') || process.env.GITHUB_WORKSPACE || process.cwd(); @@ -123,23 +123,21 @@ async function run() { if (skipComment) { core.debug('Skipping comment creation'); - core.setOutput('comment-created', 'false'); - return; - } - - // Create the comment (does not work in forks) - try { - await saveComment(accessToken, markdown); - } catch (error: unknown) { - core.warning(String(error)); - core.notice('\nFailed to create comment on pull request. Perhaps this is ran in a fork?\n'); - core.info(markdown); + } else { + // Create the comment (does not work in forks) + try { + await saveComment(accessToken, markdown); + } catch (error: unknown) { + core.warning(String(error)); + core.notice('\nFailed to create comment on pull request. Perhaps this is ran in a fork?\n'); + core.info(markdown); + } } // Create an action summary (does work in forks) await saveSummary(markdown); - core.setOutput('comment-created', 'true'); + core.setOutput('comment-created', skipComment ? 'false' : 'true'); } catch (error: unknown) { core.setOutput('comment-created', 'false'); core.setFailed((error as Error).message);