@@ -1998,7 +1998,7 @@ function requireOidcUtils () {
1998
1998
.catch(error => {
1999
1999
throw new Error(`Failed to get ID Token. \n
2000
2000
Error Code : ${error.statusCode}\n
2001
- Error Message: ${error.result. message}`);
2001
+ Error Message: ${error.message}`);
2002
2002
});
2003
2003
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
2004
2004
if (!id_token) {
@@ -89650,7 +89650,7 @@ var maxMethodCoverageDecrease = coreExports.getInput("max-method-coverage-decrea
89650
89650
var minLineCoverage = Number(coreExports.getInput("min-line-coverage"));
89651
89651
var minMethodCoverage = Number(coreExports.getInput("min-method-coverage"));
89652
89652
var showPercentageChangePerFile = coreExports.getBooleanInput("show-percentage-change-on-table");
89653
- var comment = function (cStats, oldStats, coverageType) { return __awaiter$1(void 0, void 0, void 0, function () {
89653
+ var comment = function (cStats, oldStats, coverageType, withChart, withTable ) { return __awaiter$1(void 0, void 0, void 0, function () {
89654
89654
var w;
89655
89655
return __generator(this, function (_a) {
89656
89656
w = workspace.endsWith("/") ? workspace : workspace.concat("/");
@@ -89753,10 +89753,10 @@ function checkThreshold(c, o) {
89753
89753
}
89754
89754
var notFoundMessage = "was not found, please check if the path is valid, or if it exists.";
89755
89755
var run = function () { return __awaiter$1(void 0, void 0, void 0, function () {
89756
- var commit, cStats, _a, oldStats, _b, _c, msgs, body, _d, _e, filter, u_1, commentId, comments, i, c, e_2;
89757
- var _g, _h ;
89758
- return __generator(this, function (_j ) {
89759
- switch (_j .label) {
89756
+ var commit, cStats, _a, oldStats, _b, _c, msgs, body, _d, _e, _f, _g, filter, u_1, commentId, comments, i, c, e_2;
89757
+ var _j, _k ;
89758
+ return __generator(this, function (_l ) {
89759
+ switch (_l .label) {
89760
89760
case 0:
89761
89761
if (!["lines", "methods", "branches"].includes(tableWithTypeLimit)) {
89762
89762
coreExports.error("there is no coverage type ".concat(tableWithTypeLimit));
@@ -89769,14 +89769,14 @@ var run = function () { return __awaiter$1(void 0, void 0, void 0, function () {
89769
89769
throw token
89770
89770
? "no Github token was informed !"
89771
89771
: "the Github token informed is not valid";
89772
- commit = (_g = utils$2.context.payload.pull_request) === null || _g === void 0 ? void 0 : _g .head.sha.substring(0, 7);
89772
+ commit = (_j = utils$2.context.payload.pull_request) === null || _j === void 0 ? void 0 : _j .head.sha.substring(0, 7);
89773
89773
if (!require$$0$1.existsSync(file)) {
89774
89774
throw "file \"".concat(file, "\" ").concat(notFoundMessage);
89775
89775
}
89776
89776
_a = fromString;
89777
89777
return [4 /*yield*/, require$$6.promisify(require$$0$1.readFile)(file)];
89778
89778
case 1:
89779
- cStats = _a.apply(void 0, [(_j .sent()).toString()]);
89779
+ cStats = _a.apply(void 0, [(_l .sent()).toString()]);
89780
89780
if (baseFile && !require$$0$1.existsSync(baseFile)) {
89781
89781
coreExports.error("base file \"".concat(baseFile, "\" ").concat(notFoundMessage));
89782
89782
baseFile = undefined;
@@ -89786,63 +89786,87 @@ var run = function () { return __awaiter$1(void 0, void 0, void 0, function () {
89786
89786
_c = fromString;
89787
89787
return [4 /*yield*/, require$$6.promisify(require$$0$1.readFile)(baseFile)];
89788
89788
case 2:
89789
- _b = _c.apply(void 0, [(_j .sent()).toString()]);
89790
- _j .label = 3;
89789
+ _b = _c.apply(void 0, [(_l .sent()).toString()]);
89790
+ _l .label = 3;
89791
89791
case 3:
89792
89792
oldStats = _b;
89793
89793
msgs = Array.from(checkThreshold(cStats, oldStats));
89794
89794
msgs.map(coreExports.setFailed);
89795
89795
_e = (_d = "\nCoverage report for commit: ".concat(commit, "\nFile: `").concat(file, "`\n\n").concat(msgs.map(function (m) { return "> :warning: ".concat(m); }).join("\n"), "\n\n")).concat;
89796
- return [4 /*yield*/, comment(cStats, oldStats, tableWithTypeLimit)];
89796
+ return [4 /*yield*/, comment(cStats, oldStats, tableWithTypeLimit, withChart, withTable )];
89797
89797
case 4:
89798
- body = _e.apply(_d, [_j.sent(), "\n\n"]).concat(signature);
89799
- filter = function (c) { var _a; return ((_a = c === null || c === void 0 ? void 0 : c.user) === null || _a === void 0 ? void 0 : _a.type) === "Bot"; };
89800
- _j.label = 5;
89798
+ body = _e.apply(_d, [_l.sent(), "\n\n"]).concat(signature);
89799
+ return [4 /*yield*/, coreExports.summary
89800
+ .addHeading("Coverage Report")
89801
+ .addRaw("File: <code>".concat(file, "</code>"), true)
89802
+ .addBreak()
89803
+ .write()];
89801
89804
case 5:
89802
- _j.trys.push([5, 7, , 8]);
89803
- return [4 /*yield*/, github.rest.users.getAuthenticated()];
89805
+ _l.sent();
89806
+ if (!msgs.length) return [3 /*break*/, 7];
89807
+ return [4 /*yield*/, coreExports.summary
89808
+ .addBreak()
89809
+ .addQuote(msgs.map(function (m) { return ":warning: ".concat(m); }).join("\n"))
89810
+ .write()];
89804
89811
case 6:
89805
- u_1 = _j.sent();
89812
+ _l.sent();
89813
+ _l.label = 7;
89814
+ case 7:
89815
+ _g = (_f = coreExports.summary
89816
+ .addBreak())
89817
+ .addRaw;
89818
+ return [4 /*yield*/, comment(cStats, oldStats, tableWithTypeLimit, true, false)];
89819
+ case 8: return [4 /*yield*/, _g.apply(_f, [_l.sent(), true])
89820
+ .write()];
89821
+ case 9:
89822
+ _l.sent();
89823
+ filter = function (c) { var _a; return ((_a = c === null || c === void 0 ? void 0 : c.user) === null || _a === void 0 ? void 0 : _a.type) === "Bot"; };
89824
+ _l.label = 10;
89825
+ case 10:
89826
+ _l.trys.push([10, 12, , 13]);
89827
+ return [4 /*yield*/, github.rest.users.getAuthenticated()];
89828
+ case 11:
89829
+ u_1 = _l.sent();
89806
89830
filter = function (c) { var _a; return ((_a = c === null || c === void 0 ? void 0 : c.user) === null || _a === void 0 ? void 0 : _a.login) === u_1.data.login; };
89807
89831
coreExports.debug("Using a PAT from " + u_1.data.login);
89808
- return [3 /*break*/, 8 ];
89809
- case 7 :
89810
- _j .sent();
89811
- return [3 /*break*/, 8 ];
89812
- case 8 :
89832
+ return [3 /*break*/, 13 ];
89833
+ case 12 :
89834
+ _l .sent();
89835
+ return [3 /*break*/, 13 ];
89836
+ case 13 :
89813
89837
commentId = null;
89814
- _j .label = 9 ;
89815
- case 9 :
89816
- _j .trys.push([9, 11 , , 12 ]);
89838
+ _l .label = 14 ;
89839
+ case 14 :
89840
+ _l .trys.push([14, 16 , , 17 ]);
89817
89841
return [4 /*yield*/, github.rest.issues.listComments(__assign(__assign({}, utils$2.context.repo), { issue_number: utils$2.context.issue.number }))];
89818
- case 10 :
89819
- comments = (_j .sent()).data.filter(filter);
89842
+ case 15 :
89843
+ comments = (_l .sent()).data.filter(filter);
89820
89844
for (i = comments.length - 1; i >= 0; i--) {
89821
89845
c = comments[i];
89822
- if (!((_h = c.body) === null || _h === void 0 ? void 0 : _h .includes(signature)))
89846
+ if (!((_k = c.body) === null || _k === void 0 ? void 0 : _k .includes(signature)))
89823
89847
continue;
89824
89848
commentId = c.id;
89825
89849
}
89826
- return [3 /*break*/, 12 ];
89827
- case 11 :
89828
- e_2 = _j .sent();
89850
+ return [3 /*break*/, 17 ];
89851
+ case 16 :
89852
+ e_2 = _l .sent();
89829
89853
coreExports.error(e_2);
89830
- return [3 /*break*/, 12 ];
89831
- case 12 :
89832
- if (!commentId) return [3 /*break*/, 16 ];
89833
- _j .label = 13 ;
89834
- case 13 :
89835
- _j .trys.push([13, 15 , , 16 ]);
89854
+ return [3 /*break*/, 17 ];
89855
+ case 17 :
89856
+ if (!commentId) return [3 /*break*/, 21 ];
89857
+ _l .label = 18 ;
89858
+ case 18 :
89859
+ _l .trys.push([18, 20 , , 21 ]);
89836
89860
return [4 /*yield*/, github.rest.issues.updateComment(__assign(__assign({}, utils$2.context.repo), { comment_id: commentId, body: body }))];
89837
- case 14 :
89838
- _j .sent();
89861
+ case 19 :
89862
+ _l .sent();
89839
89863
return [2 /*return*/];
89840
- case 15 :
89841
- _j .sent();
89842
- return [3 /*break*/, 16 ];
89843
- case 16 : return [4 /*yield*/, github.rest.issues.createComment(__assign(__assign({}, utils$2.context.repo), { issue_number: utils$2.context.issue.number, body: body }))];
89844
- case 17 :
89845
- _j .sent();
89864
+ case 20 :
89865
+ _l .sent();
89866
+ return [3 /*break*/, 21 ];
89867
+ case 21 : return [4 /*yield*/, github.rest.issues.createComment(__assign(__assign({}, utils$2.context.repo), { issue_number: utils$2.context.issue.number, body: body }))];
89868
+ case 22 :
89869
+ _l .sent();
89846
89870
return [2 /*return*/];
89847
89871
}
89848
89872
});
0 commit comments