From 52ada587634b53317d14e2b008ddb62fc5444aee Mon Sep 17 00:00:00 2001 From: luojiyin Date: Tue, 16 Jun 2026 09:56:48 +0800 Subject: [PATCH] fix(index): use core.setFailed() to preserve original error message --- src/@lint-md/cli.d.ts | 1 + src/index.ts | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/@lint-md/cli.d.ts b/src/@lint-md/cli.d.ts index 2c25b15..473bcac 100644 --- a/src/@lint-md/cli.d.ts +++ b/src/@lint-md/cli.d.ts @@ -2,6 +2,7 @@ declare module '@lint-md/cli' { export class Lint { constructor(files: string[], config: any) start(): Promise + showResult(): void printOverview(): void countError(): { error: number; warning: number } errorFiles: any[] diff --git a/src/index.ts b/src/index.ts index e0edb6c..42f08f2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,22 +6,17 @@ * Email: yuzl1123@163.com */ +import * as core from '@actions/core' import { LintMdAction } from './lint-md-action' const runAction = async () => { - // init LintMdAction const lintMdAction = new LintMdAction() - - // run lint await lintMdAction.lint() - - // log info lintMdAction .showResult() .showErrorOrPassInfo() } -runAction().catch(res => { - console.log(res) - throw new Error('unknown error!') +runAction().catch((err: Error) => { + core.setFailed(err.message || 'unknown error!') })