0
0
Fork 0
mirror of https://github.com/DavidAnson/markdownlint-cli2-action.git synced 2024-12-22 21:03:53 +01:00
markdownlint-cli2-action/markdownlint-cli2-action.js

23 lines
481 B
JavaScript
Raw Normal View History

2021-01-13 07:10:33 +01:00
// @ts-check
"use strict";
const core = require("@actions/core");
const {"main": markdownlintCli2} = require("markdownlint-cli2");
2021-01-13 07:10:33 +01:00
const logMessage = core.info;
const logError = core.error;
const argv =
core.getInput("globs").
split("\n").
filter((glob) => String(glob));
2021-01-13 07:10:33 +01:00
markdownlintCli2({
argv,
2021-01-13 07:10:33 +01:00
logMessage,
logError
}).then(
(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
);