2021-01-13 07:10:33 +01:00
|
|
|
// @ts-check
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const core = require("@actions/core");
|
2021-01-16 05:35:50 +01:00
|
|
|
const {"main": markdownlintCli2} = require("markdownlint-cli2");
|
2021-01-13 07:10:33 +01:00
|
|
|
|
|
|
|
const logMessage = core.info;
|
|
|
|
const logError = core.error;
|
2021-01-16 05:35:50 +01:00
|
|
|
const argv =
|
|
|
|
core.getInput("globs").
|
|
|
|
split("\n").
|
2021-02-21 04:17:39 +01:00
|
|
|
filter((glob) => String(glob));
|
2021-01-13 07:25:46 +01:00
|
|
|
|
2021-01-13 07:10:33 +01:00
|
|
|
markdownlintCli2({
|
2021-01-13 23:50:05 +01:00
|
|
|
argv,
|
2021-01-13 07:10:33 +01:00
|
|
|
logMessage,
|
|
|
|
logError
|
|
|
|
}).then(
|
2021-01-16 05:35:50 +01:00
|
|
|
(code) => code && core.setFailed(`Failed with exit code: ${code}`),
|
|
|
|
(error) => core.setFailed(`Failed due to error: ${error}`)
|
2021-01-13 07:10:33 +01:00
|
|
|
);
|