Skip to content

Commit

Permalink
chore: release v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WitoDelnat committed Oct 13, 2022
1 parent 5180b1d commit d06c212
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
52 changes: 46 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39490,6 +39490,23 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"]
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __nccwpck_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __nccwpck_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/node module decorator */
/******/ (() => {
/******/ __nccwpck_require__.nmd = (module) => {
Expand All @@ -39508,6 +39525,11 @@ var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {

// EXPORTS
__nccwpck_require__.d(__webpack_exports__, {
"c": () => (/* binding */ countProblems)
});

// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js
var core = __nccwpck_require__(2186);
// EXTERNAL MODULE: ./node_modules/fs-extra/lib/index.js
Expand Down Expand Up @@ -45366,7 +45388,12 @@ function printResponse(response) {
const L2 = `\n found at ${location.physicalLocation?.artifactLocation.uri}:${location.physicalLocation?.region?.startColumn}`;
const L3 = `\n ${rule.fullDescription.text}`;
const L4 = `\n ${rule.help.text}`;
core.error(`${L1}${L2}${L3}${L4}`);
if (result.level === "error") {
core.error(`${L1}${L2}${L3}${L4}`);
}
else {
core.warning(`${L1}${L2}${L3}${L4}`);
}
}
core.endGroup();
}
Expand Down Expand Up @@ -45560,21 +45587,32 @@ async function run() {
return;
}
const response = await validator.validate({ resources });
const errorCount = response.runs.reduce((sum, r) => sum + r.results.length, 0);
printResponse(response);
await outputSarifResponse(response);
const { problemCount, warningCount, errorCount } = countProblems(response);
if (errorCount > 0) {
core.setFailed(`${errorCount} problems detected`);
core.setFailed(`${problemCount} problems detected (${errorCount} errors)`);
}
else {
core.notice("No problems detected");
if (problemCount > 0) {
core.warning(`${warningCount} warnings detected`);
}
else {
core.notice("No problems detected");
}
}
printResponse(response);
await outputSarifResponse(response);
}
catch (error) {
if (error instanceof Error)
core.setFailed(`[unexpected] ${error.message}`);
}
}
function countProblems(response) {
const warningCount = response.runs.reduce((sum, run) => sum + run.results.reduce((s, r) => s + (r.level === "error" ? 0 : 1), 0), 0);
const errorCount = response.runs.reduce((sum, run) => sum + run.results.reduce((s, r) => s + (r.level === "error" ? 1 : 0), 0), 0);
const problemCount = warningCount + errorCount;
return { problemCount, errorCount, warningCount };
}
async function outputSarifResponse(response) {
const outputPath = `monokle-${Date.now()}.sarif`;
await lib.outputFile(outputPath, JSON.stringify(response));
Expand All @@ -45584,5 +45622,7 @@ run();

})();

var __webpack_exports__countProblems = __webpack_exports__.c;
export { __webpack_exports__countProblems as countProblems };

//# sourceMappingURL=index.js.map
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monokle-action",
"version": "0.1.5",
"version": "0.2.0",
"license": "MIT",
"author": "Kubeshop",
"description": "GitHub Action for Monokle's SARIF validator.",
Expand Down

0 comments on commit d06c212

Please sign in to comment.