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!') })