Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Commit 1392461

Browse files
committed
Refactor structure
1 parent 78fbc66 commit 1392461

20 files changed

+41
-90
lines changed

dist/check-group/core/config_getter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
7171
};
7272
Object.defineProperty(exports, "__esModule", { value: true });
7373
exports.fetchConfig = void 0;
74-
var utils_1 = require("../utils");
74+
var user_config_parser_1 = require("./user_config_parser");
7575
var core = __importStar(require("@actions/core"));
7676
/**
7777
* Fetches the app configuration from the user's repository.
@@ -106,7 +106,7 @@ var fetchConfig = function (context) { return __awaiter(void 0, void 0, void 0,
106106
_a.label = 4;
107107
case 4:
108108
core.debug("configData: ".concat(JSON.stringify(configData)));
109-
return [2 /*return*/, (0, utils_1.parseUserConfig)(configData)];
109+
return [2 /*return*/, (0, user_config_parser_1.parseUserConfig)(configData)];
110110
}
111111
});
112112
}); };

dist/check-group/utils/generate_progress.js renamed to dist/check-group/core/generate_progress.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
3636
}
3737
};
3838
Object.defineProperty(exports, "__esModule", { value: true });
39-
exports.comment = exports.getPrComment = exports.formPrComment = exports.PR_COMMENT_START = exports.generateProgressDetails = exports.statusToMark = exports.generateProgressSummary = exports.generateProgressReport = void 0;
39+
exports.commentOnPr = exports.generateProgressDetails = exports.generateProgressSummary = void 0;
4040
var generateProgressReport = function (subprojects, checksStatusLookup) {
4141
var report = {
4242
completed: [],
@@ -75,10 +75,9 @@ var generateProgressReport = function (subprojects, checksStatusLookup) {
7575
});
7676
return report;
7777
};
78-
exports.generateProgressReport = generateProgressReport;
7978
var generateProgressSummary = function (subprojects, checksStatusLookup) {
8079
var _a, _b;
81-
var report = (0, exports.generateProgressReport)(subprojects, checksStatusLookup);
80+
var report = generateProgressReport(subprojects, checksStatusLookup);
8281
var message = "Progress: ".concat((_a = report.completed) === null || _a === void 0 ? void 0 : _a.length, " completed, ").concat((_b = report.running) === null || _b === void 0 ? void 0 : _b.length, " pending");
8382
return message;
8483
};
@@ -97,7 +96,6 @@ var statusToMark = function (check, checksStatusLookup) {
9796
}
9897
return "❓";
9998
};
100-
exports.statusToMark = statusToMark;
10199
/**
102100
* Generates a progress report for currently finished checks
103101
* which will be posted in the status check report.
@@ -113,7 +111,7 @@ var generateProgressDetails = function (subprojects, checksStatusLookup) {
113111
// for padding
114112
var longestLength = Math.max.apply(Math, (subproject.checks.map(function (check) { return check.id.length; })));
115113
subproject.checks.forEach(function (check) {
116-
var mark = (0, exports.statusToMark)(check.id, checksStatusLookup);
114+
var mark = statusToMark(check.id, checksStatusLookup);
117115
var status = (check.id in checksStatusLookup) ? checksStatusLookup[check.id] : 'no_status';
118116
status = status || 'undefined';
119117
progress += "".concat(check.id.padEnd(longestLength, ' '), " | ").concat(mark, " | ").concat(status.padEnd(12, ' '), "\n");
@@ -127,7 +125,7 @@ var generateProgressDetails = function (subprojects, checksStatusLookup) {
127125
longestLength = Math.max(longestLength, availableCheck.length);
128126
}
129127
for (var availableCheck in checksStatusLookup) {
130-
var mark = (0, exports.statusToMark)(availableCheck, checksStatusLookup);
128+
var mark = statusToMark(availableCheck, checksStatusLookup);
131129
var status_2 = (availableCheck in checksStatusLookup) ? checksStatusLookup[availableCheck] : 'no_status';
132130
status_2 = status_2 || 'undefined';
133131
progress += "".concat(availableCheck.padEnd(longestLength, ' '), " | ").concat(mark, " | ").concat(status_2.padEnd(12, ' '), "\n");
@@ -136,16 +134,15 @@ var generateProgressDetails = function (subprojects, checksStatusLookup) {
136134
return progress;
137135
};
138136
exports.generateProgressDetails = generateProgressDetails;
139-
exports.PR_COMMENT_START = "<!-- checkgroup-comment-start -->";
137+
var PR_COMMENT_START = "<!-- checkgroup-comment-start -->";
140138
function formPrComment() {
141-
return (exports.PR_COMMENT_START
139+
return (PR_COMMENT_START
142140
+ "\nHello! This is a test"
143141
+ "\nThis comment was automatically generated by CheckGroup");
144142
}
145-
exports.formPrComment = formPrComment;
146143
function getPrComment(context) {
147144
return __awaiter(this, void 0, void 0, function () {
148-
var params, commentsRes, _i, _a, comment_1;
145+
var params, commentsRes, _i, _a, comment;
149146
return __generator(this, function (_b) {
150147
switch (_b.label) {
151148
case 0:
@@ -154,18 +151,17 @@ function getPrComment(context) {
154151
case 1:
155152
commentsRes = _b.sent();
156153
for (_i = 0, _a = commentsRes.data; _i < _a.length; _i++) {
157-
comment_1 = _a[_i];
158-
if (comment_1.body.includes(exports.PR_COMMENT_START)) {
159-
return [2 /*return*/, { id: comment_1.id, body: comment_1.body }];
154+
comment = _a[_i];
155+
if (comment.body.includes(PR_COMMENT_START)) {
156+
return [2 /*return*/, { id: comment.id, body: comment.body }];
160157
}
161158
}
162159
return [2 /*return*/, { id: 0, body: "" }];
163160
}
164161
});
165162
});
166163
}
167-
exports.getPrComment = getPrComment;
168-
function comment(context) {
164+
function commentOnPr(context) {
169165
return __awaiter(this, void 0, void 0, function () {
170166
var existingData, newComment;
171167
return __generator(this, function (_a) {
@@ -192,4 +188,4 @@ function comment(context) {
192188
});
193189
});
194190
}
195-
exports.comment = comment;
191+
exports.commentOnPr = commentOnPr;

dist/check-group/core/index.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
"use strict";
2-
/**
3-
* @module Core
4-
*/
52
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
63
if (k2 === undefined) k2 = k;
74
var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -63,12 +60,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
6360
};
6461
Object.defineProperty(exports, "__esModule", { value: true });
6562
exports.fetchConfig = exports.CheckGroup = void 0;
66-
var utils_1 = require("../utils");
63+
/**
64+
* @module Core
65+
*/
6766
var core = __importStar(require("@actions/core"));
67+
var generate_progress_1 = require("./generate_progress");
68+
var subproj_matching_1 = require("./subproj_matching");
69+
var satisfy_expected_checks_1 = require("./satisfy_expected_checks");
6870
var config_getter_1 = require("./config_getter");
6971
Object.defineProperty(exports, "fetchConfig", { enumerable: true, get: function () { return config_getter_1.fetchConfig; } });
70-
var utils_2 = require("../utils");
71-
var utils_3 = require("../utils");
7272
/**
7373
* The orchestration class.
7474
*/
@@ -91,7 +91,7 @@ var CheckGroup = /** @class */ (function () {
9191
case 1:
9292
filenames = _a.sent();
9393
core.info("Files are: ".concat(JSON.stringify(filenames)));
94-
subprojs = (0, utils_2.matchFilenamesToSubprojects)(filenames, this.config.subProjects);
94+
subprojs = (0, subproj_matching_1.matchFilenamesToSubprojects)(filenames, this.config.subProjects);
9595
core.debug("Matching subprojects are: ".concat(JSON.stringify(subprojs)));
9696
if (core.isDebug()) {
9797
expectedChecks = collectExpectedChecks(subprojs);
@@ -129,7 +129,7 @@ var CheckGroup = /** @class */ (function () {
129129
case 1:
130130
postedChecks = _a.sent();
131131
core.debug("postedChecks: ".concat(JSON.stringify(postedChecks)));
132-
conclusion = (0, utils_3.satisfyExpectedChecks)(subprojs, postedChecks);
132+
conclusion = (0, satisfy_expected_checks_1.satisfyExpectedChecks)(subprojs, postedChecks);
133133
this.notifyProgress(subprojs, postedChecks, conclusion);
134134
core.endGroup();
135135
if (conclusion === "all_passing") {
@@ -157,9 +157,10 @@ var CheckGroup = /** @class */ (function () {
157157
return __awaiter(this, void 0, void 0, function () {
158158
var summary, details;
159159
return __generator(this, function (_a) {
160-
summary = (0, utils_1.generateProgressSummary)(subprojs, postedChecks);
161-
details = (0, utils_1.generateProgressDetails)(subprojs, postedChecks);
160+
summary = (0, generate_progress_1.generateProgressSummary)(subprojs, postedChecks);
161+
details = (0, generate_progress_1.generateProgressDetails)(subprojs, postedChecks);
162162
core.info("".concat(this.config.customServiceName, " conclusion: '").concat(conclusion, "':\n").concat(summary, "\n").concat(details));
163+
(0, generate_progress_1.commentOnPr)(this.context);
163164
return [2 /*return*/];
164165
});
165166
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

dist/check-group/utils/index.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)