7
7
"use strict";
8
8
9
9
Object.defineProperty(exports, "__esModule", ({ value: true }));
10
- exports.HEAD_SHA = exports.BASE_SHA = exports.INVALID_REVIEWERS = exports.DEFAULT_ERROR_MESSAGE = void 0;
10
+ exports.DEFAULT_MAX_REVIEWERS = exports. HEAD_SHA = exports.BASE_SHA = exports.INVALID_REVIEWERS = exports.DEFAULT_ERROR_MESSAGE = void 0;
11
11
exports.DEFAULT_ERROR_MESSAGE = 'An unexpected error occurred!';
12
12
exports.INVALID_REVIEWERS = [
13
13
'GitHub',
@@ -21,6 +21,7 @@ exports.INVALID_REVIEWERS = [
21
21
];
22
22
exports.BASE_SHA = '2d2f73c099310be56ace9e4aa3a922eb23ff0650';
23
23
exports.HEAD_SHA = '71c867b0d68417a9de4774aedb92182169028538';
24
+ exports.DEFAULT_MAX_REVIEWERS = 2;
24
25
25
26
26
27
/***/ }),
@@ -135,6 +136,29 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
135
136
__exportStar(__nccwpck_require__(3694), exports);
136
137
__exportStar(__nccwpck_require__(3324), exports);
137
138
__exportStar(__nccwpck_require__(5397), exports);
139
+ __exportStar(__nccwpck_require__(2498), exports);
140
+
141
+
142
+ /***/ }),
143
+
144
+ /***/ 2498:
145
+ /***/ ((__unused_webpack_module, exports) => {
146
+
147
+ "use strict";
148
+
149
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
150
+ exports.sendReviewRequests = void 0;
151
+ const sendReviewRequests = async ({ Octokit, reviewers, context, }) => {
152
+ var _a;
153
+ console.log({ reviewers, context, repo: context.repo });
154
+ return Octokit.rest.pulls.requestReviewers({
155
+ owner: context.repo.owner,
156
+ repo: context.repo.repo,
157
+ pull_number: (_a = context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.number,
158
+ reviewers,
159
+ });
160
+ };
161
+ exports.sendReviewRequests = sendReviewRequests;
138
162
139
163
140
164
/***/ }),
@@ -30339,7 +30363,9 @@ const run = async () => {
30339
30363
const baseSha = ((_a = github_1.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.base.sha) || constants_1.BASE_SHA;
30340
30364
const headSha = ((_b = github_1.context.payload.pull_request) === null || _b === void 0 ? void 0 : _b.head.sha) || constants_1.HEAD_SHA;
30341
30365
const creator = (_c = github_1.context.payload.pull_request) === null || _c === void 0 ? void 0 : _c.user.login;
30366
+ const maxReviewers = (0, core_1.getInput)('max-reviewers');
30342
30367
const token = (0, core_1.getInput)('github-token');
30368
+ console.log({ maxReviewers, type: typeof maxReviewers });
30343
30369
const Octokit = (0, github_1.getOctokit)(token);
30344
30370
const changedFiles = await (0, helpers_1.getChangedFiles)(baseSha, headSha);
30345
30371
if (!changedFiles)
@@ -30351,11 +30377,19 @@ const run = async () => {
30351
30377
const validReviewers = (0, get_valid_reviewers_1.getValidReviewers)({
30352
30378
reviewers: usernames,
30353
30379
creator,
30354
- maxReviewers: 3,
30380
+ maxReviewers: isNaN(Number(maxReviewers))
30381
+ ? constants_1.DEFAULT_MAX_REVIEWERS
30382
+ : Number(maxReviewers),
30355
30383
});
30356
30384
if (!(validReviewers === null || validReviewers === void 0 ? void 0 : validReviewers.length))
30357
30385
return (0, core_1.warning)('No valid reviewers found!');
30358
- console.log({ usernames, changedFiles });
30386
+ console.log({ validReviewers });
30387
+ const response = (0, helpers_1.sendReviewRequests)({
30388
+ Octokit,
30389
+ reviewers: validReviewers,
30390
+ context: github_1.context,
30391
+ });
30392
+ console.log({ response });
30359
30393
}
30360
30394
catch (error) {
30361
30395
console.log({ error });
0 commit comments