Skip to content

Commit

Permalink
changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry-Hong committed Oct 25, 2024
1 parent 3ba7628 commit 8823a65
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/on-pull-request-review-comment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: on pull request review comment
name: ๐Ÿ‘Œ On Pull Request Review

on:
pull_request_review:
Expand All @@ -11,6 +11,7 @@ jobs:
- name: checkout-branch
uses: actions/checkout@v3

# ๋ชจ๋“  ๋ฆฌ๋ทฐ์ฝ”๋ฉ˜ํŠธ๊ฐ€ NIT์„ ํฌํ•จํ•˜๋Š”์ง€ ํ™•์ธํ•œ๋‹ค.
- name: check-comment
id: check-comment
uses: actions/github-script@v6
Expand All @@ -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:
Expand Down

0 comments on commit 8823a65

Please sign in to comment.