Skip to content

Commit f26f0d3

Browse files
committed
(wip)
1 parent e5e1e9d commit f26f0d3

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

bin/index.js

+28-28
Original file line numberDiff line numberDiff line change
@@ -89757,9 +89757,9 @@ var err = function (e) {
8975789757
var notFoundMessage = "was not found, please check if the path is valid, or if it exists.";
8975889758
var run = function () { return __awaiter$1(void 0, void 0, void 0, function () {
8975989759
var commit, cStats, _a, oldStats, _b, _c, msgs, body, _d, _e, _f, _g, filter, u_1, e_1, commentId, comments, i, c, e_2;
89760-
var _j, _k;
89761-
return __generator(this, function (_l) {
89762-
switch (_l.label) {
89760+
var _j, _k, _l, _m;
89761+
return __generator(this, function (_o) {
89762+
switch (_o.label) {
8976389763
case 0:
8976489764
if (!["lines", "methods", "branches"].includes(tableWithTypeLimit)) {
8976589765
coreExports.error("there is no coverage type ".concat(tableWithTypeLimit));
@@ -89779,7 +89779,7 @@ var run = function () { return __awaiter$1(void 0, void 0, void 0, function () {
8977989779
_a = fromString;
8978089780
return [4 /*yield*/, require$$6.promisify(require$$0$1.readFile)(file)];
8978189781
case 1:
89782-
cStats = _a.apply(void 0, [(_l.sent()).toString()]);
89782+
cStats = _a.apply(void 0, [(_o.sent()).toString()]);
8978389783
if (baseFile && !require$$0$1.existsSync(baseFile)) {
8978489784
coreExports.error("base file \"".concat(baseFile, "\" ").concat(notFoundMessage));
8978589785
baseFile = undefined;
@@ -89789,87 +89789,87 @@ var run = function () { return __awaiter$1(void 0, void 0, void 0, function () {
8978989789
_c = fromString;
8979089790
return [4 /*yield*/, require$$6.promisify(require$$0$1.readFile)(baseFile)];
8979189791
case 2:
89792-
_b = _c.apply(void 0, [(_l.sent()).toString()]);
89793-
_l.label = 3;
89792+
_b = _c.apply(void 0, [(_o.sent()).toString()]);
89793+
_o.label = 3;
8979489794
case 3:
8979589795
oldStats = _b;
8979689796
msgs = Array.from(checkThreshold(cStats, oldStats));
8979789797
msgs.map(coreExports.setFailed);
8979889798
_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;
8979989799
return [4 /*yield*/, comment(cStats, oldStats, tableWithTypeLimit, withChart, withTable)];
8980089800
case 4:
89801-
body = _e.apply(_d, [_l.sent(), "\n\n"]).concat(signature);
89801+
body = _e.apply(_d, [_o.sent(), "\n\n"]).concat(signature);
8980289802
return [4 /*yield*/, coreExports.summary
8980389803
.addHeading("Coverage Report")
8980489804
.addRaw("File: <code>".concat(file, "</code>"), true)
8980589805
.addBreak()
8980689806
.write()];
8980789807
case 5:
89808-
_l.sent();
89808+
_o.sent();
8980989809
if (!msgs.length) return [3 /*break*/, 7];
8981089810
return [4 /*yield*/, coreExports.summary
8981189811
.addBreak()
8981289812
.addQuote(msgs.map(function (m) { return ":warning: ".concat(m); }).join("\n"))
8981389813
.write()];
8981489814
case 6:
89815-
_l.sent();
89816-
_l.label = 7;
89815+
_o.sent();
89816+
_o.label = 7;
8981789817
case 7:
8981889818
_g = (_f = coreExports.summary
8981989819
.addBreak())
8982089820
.addRaw;
8982189821
return [4 /*yield*/, comment(cStats, oldStats, tableWithTypeLimit, true, false)];
89822-
case 8: return [4 /*yield*/, _g.apply(_f, [_l.sent(), true])
89822+
case 8: return [4 /*yield*/, _g.apply(_f, [_o.sent(), true])
8982389823
.write()];
8982489824
case 9:
89825-
_l.sent();
89825+
_o.sent();
8982689826
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"; };
89827-
_l.label = 10;
89827+
_o.label = 10;
8982889828
case 10:
89829-
_l.trys.push([10, 12, , 13]);
89829+
_o.trys.push([10, 12, , 13]);
8983089830
return [4 /*yield*/, github.rest.users.getAuthenticated()];
8983189831
case 11:
89832-
u_1 = _l.sent();
89832+
u_1 = _o.sent();
8983389833
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; };
8983489834
coreExports.info("Using a PAT from " +
8983589835
u_1.data.login +
89836-
" with scopes " +
89837-
u_1.headers["x-oauth-scopes"]);
89836+
" with scopes: " +
89837+
(((_l = (_k = u_1.headers["x-oauth-scopes"]) === null || _k === void 0 ? void 0 : _k.split(/,\s+/)) === null || _l === void 0 ? void 0 : _l.join(", ")) || "(empty)"));
8983889838
return [3 /*break*/, 13];
8983989839
case 12:
89840-
e_1 = _l.sent();
89840+
e_1 = _o.sent();
8984189841
err(e_1);
8984289842
return [3 /*break*/, 13];
8984389843
case 13:
8984489844
commentId = null;
89845-
_l.label = 14;
89845+
_o.label = 14;
8984689846
case 14:
89847-
_l.trys.push([14, 16, , 17]);
89847+
_o.trys.push([14, 16, , 17]);
8984889848
return [4 /*yield*/, github.rest.issues.listComments(__assign(__assign({}, utils$2.context.repo), { issue_number: utils$2.context.issue.number }))];
8984989849
case 15:
89850-
comments = (_l.sent()).data.filter(filter);
89850+
comments = (_o.sent()).data.filter(filter);
8985189851
for (i = comments.length - 1; i >= 0; i--) {
8985289852
c = comments[i];
89853-
if (!((_k = c.body) === null || _k === void 0 ? void 0 : _k.includes(signature)))
89853+
if (!((_m = c.body) === null || _m === void 0 ? void 0 : _m.includes(signature)))
8985489854
continue;
8985589855
commentId = c.id;
8985689856
}
8985789857
return [3 /*break*/, 17];
8985889858
case 16:
89859-
e_2 = _l.sent();
89859+
e_2 = _o.sent();
8986089860
err(e_2);
8986189861
return [3 /*break*/, 17];
8986289862
case 17:
8986389863
if (!commentId) return [3 /*break*/, 21];
89864-
_l.label = 18;
89864+
_o.label = 18;
8986589865
case 18:
89866-
_l.trys.push([18, 20, , 21]);
89866+
_o.trys.push([18, 20, , 21]);
8986789867
return [4 /*yield*/, github.rest.issues.updateComment(__assign(__assign({}, utils$2.context.repo), { comment_id: commentId, body: body }))];
8986889868
case 19:
89869-
_l.sent();
89869+
_o.sent();
8987089870
return [2 /*return*/];
8987189871
case 20:
89872-
_l.sent();
89872+
_o.sent();
8987389873
return [3 /*break*/, 21];
8987489874
case 21: return [4 /*yield*/, github.rest.issues
8987589875
.createComment(__assign(__assign({}, utils$2.context.repo), { issue_number: utils$2.context.issue.number, body: body }))
@@ -89879,7 +89879,7 @@ var run = function () { return __awaiter$1(void 0, void 0, void 0, function () {
8987989879
(e.stack ? ". Stack: " + e.stack : ""));
8988089880
})];
8988189881
case 22:
89882-
_l.sent();
89882+
_o.sent();
8988389883
return [2 /*return*/];
8988489884
}
8988589885
});

src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ ${signature}`;
280280
info(
281281
"Using a PAT from " +
282282
u.data.login +
283-
" with scopes " +
284-
u.headers["x-oauth-scopes"]
283+
" with scopes: " +
284+
(u.headers["x-oauth-scopes"]?.split(/,\s+/)?.join(", ") || "(empty)")
285285
);
286286
} catch (e) {
287287
err(e);

0 commit comments

Comments
 (0)