Skip to content

Commit

Permalink
fix: subject 라벨 추가 위치 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeSeoKim committed Aug 19, 2021
1 parent dd2bf26 commit 4add255
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 70 deletions.
96 changes: 48 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,58 +102,58 @@ jobs:
with:
github-token: ${{ secrets.SECRET_PAT }}
script: |
const prlistConfig = github.pulls.list.endpoint.merge({
owner: context.repo.owner,
repo: context.repo.repo,
});
const prList = await github.paginate(prlistConfig);
for (const pr of prList) {
if (
pr.state === "open" &&
!!pr.labels.find(
(label) => label.name === "${{ github.event.inputs.subject }}"
)
) {
const prlistConfig = github.pulls.list.endpoint.merge({
owner: context.repo.owner,
repo: context.repo.repo,
});
const prList = await github.paginate(prlistConfig);
for (const pr of prList) {
if (
pr.state === "open" &&
!!pr.labels.find(
(label) => label.name === "${{ github.event.inputs.currect-label }}"
(label) => label.name === "${{ github.event.inputs.subject }}"
)
) {
await github.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
team_reviewers: ["${{ github.event.inputs.reviewer }}"],
});
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: [
`🎉 평가 매칭이 되셨습니다! 리뷰어를 확인후 아래의 주의 사항을 확인하여 진행 해주세요!`,
`- ⚠️ 평가시 주의 사항`,
` - 본과정과 동일 하게 위에서 틀린 경우 그 즉시 평가점수 부여는 멈춰야 합니다.`,
` - 평가를 진행 할때 PR의 CodeReview 기능을 이용해서 \`approve\`로 리뷰를 남겨주세요.`,
` - \`comment\` 로 작성하여 남겨주시면 스탭분들이 확인하는데 어려움을 격습니다 ㅠㅠ`,
` - PR 리뷰에 구글 폼 제출 후 나오는 점수 결과를 꼭 같이 제출 하여주세요!`,
].join("\n"),
});
} else if (
!!pr.labels.find(
(label) => label.name === "${{ github.event.inputs.wrong-label }}"
)
) {
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: [
`😭 안타깝지만 제출 기간내에 정상적으로 제출이 되지 않아서 0점으로 처리 됩니다.`,
`- 정상적으로 처리가 되지 않는 경우에는 \`#team_qna\` 에 문의 해주세요!`,
`- 만약 리뷰를 받고 싶은 경우 주변 동료 분들께 개인적으로 리뷰를 요청해서 진행하여 주세요!`,
].join("\n"),
});
if (
!!pr.labels.find(
(label) => label.name === "${{ github.event.inputs.currect-label }}"
)
) {
await github.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
team_reviewers: ["${{ github.event.inputs.reviewer }}"],
});
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: [
`🎉 평가 매칭이 되셨습니다! 리뷰어를 확인후 아래의 주의 사항을 확인하여 진행 해주세요!`,
`- ⚠️ 평가시 주의 사항`,
` - 본과정과 동일 하게 위에서 틀린 경우 그 즉시 평가점수 부여는 멈춰야 합니다.`,
` - 평가를 진행 할때 PR의 CodeReview 기능을 이용해서 \`approve\`로 리뷰를 남겨주세요.`,
` - \`comment\` 로 작성하여 남겨주시면 스탭분들이 확인하는데 어려움을 격습니다 ㅠㅠ`,
` - PR 리뷰에 구글 폼 제출 후 나오는 점수 결과를 꼭 같이 제출 하여주세요!`,
].join("\n"),
});
} else if (
!!pr.labels.find(
(label) => label.name === "${{ github.event.inputs.wrong-label }}"
)
) {
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: [
`😭 안타깝지만 제출 기간내에 정상적으로 제출이 되지 않아서 0점으로 처리 됩니다.`,
`- 정상적으로 처리가 되지 않는 경우에는 \`#team_qna\` 에 문의 해주세요!`,
`- 만약 리뷰를 받고 싶은 경우 주변 동료 분들께 개인적으로 리뷰를 요청해서 진행하여 주세요!`,
].join("\n"),
});
}
}
}
}
```
19 changes: 9 additions & 10 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,24 @@ var run = function () { return __awaiter(void 0, void 0, void 0, function () {
_e.sent();
core.info("PR " + prNumber + ": wrong submission (too many submissions)");
return [2 /*return*/];
case 7:
case 7: return [4 /*yield*/, exports.addLabels(client, prNumber, [subjects[0], currectLabel_1])];
case 8:
_e.sent();
subject = config.subjects[subjects[0]];
if (!(Date.parse(subject.asOfDate) > Date.now())) return [3 /*break*/, 9];
if (!(Date.parse(subject.asOfDate) > Date.now())) return [3 /*break*/, 10];
return [4 /*yield*/, exports.wrongSubmission(client, prNumber, [wrongLabel_1, REASON.EARLY_SUBMISSION], removeLabels, [
!!pr.user && "\uD83D\uDC4B \uC548\uB155\uD558\uC138\uC694! " + pr.user.login + "\uB2D8!",
"- Subject \uC81C\uCD9C \uAE30\uAC04\uC774 \uC544\uB2D9\uB2C8\uB2E4! \uC544\uB798\uC758 \uC815\uBCF4\uB97C \uD655\uC778 \uD574\uC8FC\uC138\uC694! ",
"- PR \uC81C\uCD9C \uAE30\uAC04: " + exports.toLocalString(subject.asOfDate) + " ~ " + exports.toLocalString(subject.dueDate),
"- PR \uC81C\uCD9C \uC2DC\uAC01: " + exports.toLocalString(pr.created_at),
"- PR \uB9C8\uC9C0\uB9C9 \uC5C5\uB370\uC774\uD2B8 \uC2DC\uAC01: " + exports.toLocalString(pr.updated_at),
].join("\n"))];
case 8:
case 9:
_e.sent();
core.info("PR " + prNumber + ": early submission");
return [2 /*return*/];
case 9:
if (!(Date.parse(subject.dueDate) < Date.parse(pr.updated_at))) return [3 /*break*/, 11];
case 10:
if (!(Date.parse(subject.dueDate) < Date.parse(pr.updated_at))) return [3 /*break*/, 12];
return [4 /*yield*/, exports.wrongSubmission(client, prNumber, [wrongLabel_1, REASON.LATE_SUBMISSION], removeLabels, [
!!pr.user && "\uD83D\uDC4B \uC548\uB155\uD558\uC138\uC694! " + pr.user.login + "\uB2D8!",
"- \uD83D\uDE2D \uC548\uD0C0\uAE5D\uC9C0\uB9CC \uC11C\uBE0C\uC81D\uD2B8 \uC81C\uCD9C\uAE30\uAC04\uC774 \uC9C0\uB0AC\uC2B5\uB2C8\uB2E4.",
Expand All @@ -179,11 +181,11 @@ var run = function () { return __awaiter(void 0, void 0, void 0, function () {
"- PR \uC81C\uCD9C \uC2DC\uAC01: " + exports.toLocalString(pr.created_at),
"- PR \uB9C8\uC9C0\uB9C9 \uC5C5\uB370\uC774\uD2B8 \uC2DC\uAC01: " + exports.toLocalString(pr.updated_at),
].join("\n"))];
case 10:
case 11:
_e.sent();
core.info("PR " + prNumber + ": late submission");
return [2 /*return*/];
case 11:
case 12:
if (pr.labels.find(function (label) { return label.name === wrongLabel_1; })) {
exports.removeLabel(client, prNumber, wrongLabel_1);
}
Expand All @@ -196,9 +198,6 @@ var run = function () { return __awaiter(void 0, void 0, void 0, function () {
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
19 changes: 9 additions & 10 deletions lib/pr-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,24 @@ var run = function () { return __awaiter(void 0, void 0, void 0, function () {
_e.sent();
core.info("PR " + prNumber + ": wrong submission (too many submissions)");
return [2 /*return*/];
case 7:
case 7: return [4 /*yield*/, exports.addLabels(client, prNumber, [subjects[0], currectLabel_1])];
case 8:
_e.sent();
subject = config.subjects[subjects[0]];
if (!(Date.parse(subject.asOfDate) > Date.now())) return [3 /*break*/, 9];
if (!(Date.parse(subject.asOfDate) > Date.now())) return [3 /*break*/, 10];
return [4 /*yield*/, exports.wrongSubmission(client, prNumber, [wrongLabel_1, REASON.EARLY_SUBMISSION], removeLabels, [
!!pr.user && "\uD83D\uDC4B \uC548\uB155\uD558\uC138\uC694! " + pr.user.login + "\uB2D8!",
"- Subject \uC81C\uCD9C \uAE30\uAC04\uC774 \uC544\uB2D9\uB2C8\uB2E4! \uC544\uB798\uC758 \uC815\uBCF4\uB97C \uD655\uC778 \uD574\uC8FC\uC138\uC694! ",
"- PR \uC81C\uCD9C \uAE30\uAC04: " + exports.toLocalString(subject.asOfDate) + " ~ " + exports.toLocalString(subject.dueDate),
"- PR \uC81C\uCD9C \uC2DC\uAC01: " + exports.toLocalString(pr.created_at),
"- PR \uB9C8\uC9C0\uB9C9 \uC5C5\uB370\uC774\uD2B8 \uC2DC\uAC01: " + exports.toLocalString(pr.updated_at),
].join("\n"))];
case 8:
case 9:
_e.sent();
core.info("PR " + prNumber + ": early submission");
return [2 /*return*/];
case 9:
if (!(Date.parse(subject.dueDate) < Date.parse(pr.updated_at))) return [3 /*break*/, 11];
case 10:
if (!(Date.parse(subject.dueDate) < Date.parse(pr.updated_at))) return [3 /*break*/, 12];
return [4 /*yield*/, exports.wrongSubmission(client, prNumber, [wrongLabel_1, REASON.LATE_SUBMISSION], removeLabels, [
!!pr.user && "\uD83D\uDC4B \uC548\uB155\uD558\uC138\uC694! " + pr.user.login + "\uB2D8!",
"- \uD83D\uDE2D \uC548\uD0C0\uAE5D\uC9C0\uB9CC \uC11C\uBE0C\uC81D\uD2B8 \uC81C\uCD9C\uAE30\uAC04\uC774 \uC9C0\uB0AC\uC2B5\uB2C8\uB2E4.",
Expand All @@ -172,11 +174,11 @@ var run = function () { return __awaiter(void 0, void 0, void 0, function () {
"- PR \uC81C\uCD9C \uC2DC\uAC01: " + exports.toLocalString(pr.created_at),
"- PR \uB9C8\uC9C0\uB9C9 \uC5C5\uB370\uC774\uD2B8 \uC2DC\uAC01: " + exports.toLocalString(pr.updated_at),
].join("\n"))];
case 10:
case 11:
_e.sent();
core.info("PR " + prNumber + ": late submission");
return [2 /*return*/];
case 11:
case 12:
if (pr.labels.find(function (label) { return label.name === wrongLabel_1; })) {
exports.removeLabel(client, prNumber, wrongLabel_1);
}
Expand All @@ -189,9 +191,6 @@ var run = function () { return __awaiter(void 0, void 0, void 0, function () {
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
4 changes: 2 additions & 2 deletions src/pr-checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ export const run = async () => {
return;
}

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

const subject = config.subjects[subjects[0]];

if (Date.parse(subject.asOfDate) > Date.now()) {
Expand Down Expand Up @@ -162,8 +164,6 @@ export const run = async () => {
}
}

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

await addComment(
client,
prNumber,
Expand Down

0 comments on commit 4add255

Please sign in to comment.