From 642a7979dab8c80f1c75ff531beb56ec494ae0ef Mon Sep 17 00:00:00 2001 From: Dan Hemberger <846186+hemberger@users.noreply.github.com> Date: Wed, 16 Feb 2022 04:44:13 -0800 Subject: [PATCH] lib.ts: adjust status logging levels (#1033) GitHub reports when workflow runs log messages with `notice` or higher logging levels, e.g.: > There are 0 failures, 0 warnings, and 1 notices. Since `notice` was being used regardless of status, these reports were misleading, because everything was working correctly on successes and no-ops. Therefore, the successes and no-ops now only log with `info`, and the failures now only log with `notice`. --- src/lib.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/lib.ts b/src/lib.ts index 73e61677..7a8081ea 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -73,16 +73,13 @@ export default async function run( setFailed(extractErrorMessage(error)) } finally { - const terminationMessage = `${ - status === Status.FAILED - ? 'Deployment failed! ❌' - : status === Status.SUCCESS - ? 'Completed deployment successfully! ✅' - : 'There is nothing to commit. Exiting early… 📭' - }` - - info(terminationMessage) - notice(terminationMessage) + if (status === Status.FAILED) { + notice('Deployment failed! ❌') + } else if (status === Status.SUCCESS) { + info('Completed deployment successfully! ✅') + } else { + info('There is nothing to commit. Exiting early… 📭') + } exportVariable('deployment_status', status) setOutput('deployment-status', status)