Skip to content

Commit

Permalink
fix: duplicate variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeSeoKim committed Aug 19, 2021
1 parent 6a6eea0 commit dd2bf26
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
20 changes: 12 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var REASON = {
LATE_SUBMISSION: "late-submission",
};
var run = function () { return __awaiter(void 0, void 0, void 0, function () {
var token, currectLabel_1, wrongLabel_1, configPath, prNumber, client, config, pr, changedFiles, subjects, removeLabels, _loop_1, _i, _a, _b, key, subject_1, subject, _c, _d, label, error_1;
var token, currectLabel_1, wrongLabel_1, configPath, prNumber, client, config, pr, changedFiles, subjects, removeLabels, _loop_1, _i, _a, _b, key, subject_1, subject, _loop_2, _c, _d, reason, error_1;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
Expand Down Expand Up @@ -183,18 +183,22 @@ var run = function () { return __awaiter(void 0, void 0, void 0, function () {
_e.sent();
core.info("PR " + prNumber + ": late submission");
return [2 /*return*/];
case 11: return [4 /*yield*/, exports.addLabels(client, prNumber, [subjects[0], currectLabel_1])];
case 12:
_e.sent();
case 11:
if (pr.labels.find(function (label) { return label.name === wrongLabel_1; })) {
exports.removeLabel(client, prNumber, wrongLabel_1);
}
for (_c = 0, _d = Object.values(REASON); _c < _d.length; _c++) {
label = _d[_c];
if (pr.labels.find(function (label) { return label.name === label; })) {
exports.removeLabel(client, prNumber, label);
_loop_2 = function (reason) {
if (pr.labels.find(function (label) { return label.name === reason; })) {
exports.removeLabel(client, prNumber, reason);
}
};
for (_c = 0, _d = Object.values(REASON); _c < _d.length; _c++) {
reason = _d[_c];
_loop_2(reason);
}
return [4 /*yield*/, exports.addLabels(client, prNumber, [subjects[0], currectLabel_1])];
case 12:
_e.sent();
return [4 /*yield*/, exports.addComment(client, prNumber, [
!!pr.user && "\uD83D\uDC4B \uC548\uB155\uD558\uC138\uC694! " + pr.user.login + "\uB2D8!",
"- \uD83C\uDF89 \uC815\uC0C1\uC801\uC73C\uB85C \uC81C\uCD9C \uB418\uC168\uC2B5\uB2C8\uB2E4! \uD3C9\uAC00 \uB9E4\uCE6D\uC744 \uAE30\uB2EC\uB824\uC8FC\uC138\uC694!",
Expand Down
20 changes: 12 additions & 8 deletions lib/pr-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var REASON = {
LATE_SUBMISSION: "late-submission",
};
var run = function () { return __awaiter(void 0, void 0, void 0, function () {
var token, currectLabel_1, wrongLabel_1, configPath, prNumber, client, config, pr, changedFiles, subjects, removeLabels, _loop_1, _i, _a, _b, key, subject_1, subject, _c, _d, label, error_1;
var token, currectLabel_1, wrongLabel_1, configPath, prNumber, client, config, pr, changedFiles, subjects, removeLabels, _loop_1, _i, _a, _b, key, subject_1, subject, _loop_2, _c, _d, reason, error_1;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
Expand Down Expand Up @@ -176,18 +176,22 @@ var run = function () { return __awaiter(void 0, void 0, void 0, function () {
_e.sent();
core.info("PR " + prNumber + ": late submission");
return [2 /*return*/];
case 11: return [4 /*yield*/, exports.addLabels(client, prNumber, [subjects[0], currectLabel_1])];
case 12:
_e.sent();
case 11:
if (pr.labels.find(function (label) { return label.name === wrongLabel_1; })) {
exports.removeLabel(client, prNumber, wrongLabel_1);
}
for (_c = 0, _d = Object.values(REASON); _c < _d.length; _c++) {
label = _d[_c];
if (pr.labels.find(function (label) { return label.name === label; })) {
exports.removeLabel(client, prNumber, label);
_loop_2 = function (reason) {
if (pr.labels.find(function (label) { return label.name === reason; })) {
exports.removeLabel(client, prNumber, reason);
}
};
for (_c = 0, _d = Object.values(REASON); _c < _d.length; _c++) {
reason = _d[_c];
_loop_2(reason);
}
return [4 /*yield*/, exports.addLabels(client, prNumber, [subjects[0], currectLabel_1])];
case 12:
_e.sent();
return [4 /*yield*/, exports.addComment(client, prNumber, [
!!pr.user && "\uD83D\uDC4B \uC548\uB155\uD558\uC138\uC694! " + pr.user.login + "\uB2D8!",
"- \uD83C\uDF89 \uC815\uC0C1\uC801\uC73C\uB85C \uC81C\uCD9C \uB418\uC168\uC2B5\uB2C8\uB2E4! \uD3C9\uAC00 \uB9E4\uCE6D\uC744 \uAE30\uB2EC\uB824\uC8FC\uC138\uC694!",
Expand Down
10 changes: 5 additions & 5 deletions src/pr-checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,18 @@ export const run = async () => {
return;
}

await addLabels(client, prNumber, [subjects[0], currectLabel]);

if (pr.labels.find((label) => label.name === wrongLabel)) {
removeLabel(client, prNumber, wrongLabel);
}

for (const label of Object.values(REASON)) {
if (pr.labels.find((label) => label.name === label)) {
removeLabel(client, prNumber, label);
for (const reason of Object.values(REASON)) {
if (pr.labels.find((label) => label.name === reason)) {
removeLabel(client, prNumber, reason);
}
}

await addLabels(client, prNumber, [subjects[0], currectLabel]);

await addComment(
client,
prNumber,
Expand Down

0 comments on commit dd2bf26

Please sign in to comment.