From b1ad7ae82ea10d856d5677f38293da6a027b2371 Mon Sep 17 00:00:00 2001 From: Ben Hodgson Date: Mon, 15 Jun 2026 20:51:37 +0100 Subject: [PATCH] fix: Await lint() to ensure errors are caught correctly Unhandled promise rejections from async errors inside lint() were not being caught by the surrounding try/catch. Wrapping in an async IIFE ensures all errors propagate to core.setFailed as intended. Co-Authored-By: Claude Sonnet 4.6 --- src/main.ts | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main.ts b/src/main.ts index 5d9055a..07b8e9a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,16 +2,24 @@ import core from '@actions/core'; import { lint } from './lint'; import { getActionConfig } from './utils/config'; -try { - const { - githubToken, - githubWorkspace, - rulesPath, - enforcedScopeTypes, - scopeRegex - } = getActionConfig(); +(async () => { + try { + const { + githubToken, + githubWorkspace, + rulesPath, + enforcedScopeTypes, + scopeRegex + } = getActionConfig(); - lint(githubToken, githubWorkspace, rulesPath, enforcedScopeTypes, scopeRegex); -} catch (e) { - core.setFailed(`Failed to run action with error: ${e}`); -} + await lint( + githubToken, + githubWorkspace, + rulesPath, + enforcedScopeTypes, + scopeRegex + ); + } catch (e) { + core.setFailed(`Failed to run action with error: ${e}`); + } +})();