diff --git a/.github/workflows/on-pull-request-review-comment.yml b/.github/workflows/on-pull-request-review-comment.yml index d589a4d..f530c19 100644 --- a/.github/workflows/on-pull-request-review-comment.yml +++ b/.github/workflows/on-pull-request-review-comment.yml @@ -1,4 +1,4 @@ -name: on pull request review comment +name: πŸ‘Œ On Pull Request Review on: pull_request_review: @@ -11,6 +11,7 @@ jobs: - name: checkout-branch uses: actions/checkout@v3 + # λͺ¨λ“  λ¦¬λ·°μ½”λ©˜νŠΈκ°€ NIT을 ν¬ν•¨ν•˜λŠ”μ§€ ν™•μΈν•œλ‹€. - name: check-comment id: check-comment uses: actions/github-script@v6 @@ -26,13 +27,25 @@ jobs: const recentComment = reviewComments.at(-1); const reviewId = recentComment.pull_request_review_id; const reviewCommentsInThisReview = reviewComments.filter(comment => comment.pull_request_review_id === reviewId); - const haveAllReviewCommentsContainNIT = reviewCommentsInThisReview.every(comment => comment.body.includes('NIT')); + + const TRUNCATE_COMMENT_LENGTH = 30; + + let haveAllReviewCommentsContainNIT = true; + + for(const comment of reviewCommentsInThisReview) { + const truncatedComment = comment.body.slice(0, TRUNCATE_COMMENT_LENGTH); + const isTruncated = comment.body.length > TRUNCATE_COMMENT_LENGTH; + console.log(truncatedComment + (isTruncated ? '..' : '')); + + if(!comment.body.includes('NIT')) haveAllReviewCommentsContainNIT = false; + } console.log(haveAllReviewCommentsContainNIT ? "πŸ‘πŸ» All review comments contain NIT(Not Important Though)" : "πŸ™‡ Some review comments says Need To Change"); if(haveAllReviewCommentsContainNIT) return true; else return false; + # μ–΄λ–€ 리뷰 μ½”λ©˜νŠΈκ°€ NIT을 ν¬ν•¨ν•˜μ§€ μ•ŠλŠ”λ‹€λ©΄, 변경이 ν•„μš”ν•˜λ―€λ‘œ PR을 draft μƒνƒœλ‘œ λ§Œλ“ λ‹€. - name: make-this-pr-to-draft if: ${{ steps.check-comment.outputs.result == 'false' }} env: