-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 작성된 PR 리뷴 및 댓글을 확인하여 고유 사용자 수를 체크합니다. - 리뷰어 및 댓글 작성자가 충분하지 않으면 머지를 방지합니다.
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: PR 리뷰 및 댓글 확인 | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
pull_request_review: | ||
types: [submitted] | ||
pull_request_review_comment: | ||
types: [created] | ||
|
||
jobs: | ||
check-reviews-and-comments: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 리포지토리 체크아웃 | ||
uses: actions/checkout@v2 | ||
|
||
- name: 풀 리퀘스트 리뷰 및 댓글 가져오기 | ||
id: get_reviews_and_comments | ||
run: | | ||
REVIEWS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews" | jq -r '.[].user.login' | tr '\n' ' ') | ||
COMMENTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" | jq -r '.[].user.login' | tr '\n' ' ') | ||
ALL_USERS="$REVIEWS $COMMENTS" | ||
echo "ALL_USERS=\"$ALL_USERS\"" >> $GITHUB_ENV | ||
- name: 고유 사용자 확인 | ||
run: | | ||
echo "ALL_USERS=$ALL_USERS" | ||
UNIQUE_USERS=$(echo "$ALL_USERS" | tr ' ' '\n' | sort | uniq | wc -l) | ||
echo "Unique Users Count: $UNIQUE_USERS" | ||
if [ "$UNIQUE_USERS" -lt 2 ]; then | ||
echo "고유 리뷰어 및 댓글 작성자가 충분하지 않습니다. 머지 전에 최소 2명의 고유 리뷰어 또는 댓글 작성자가 있어야 합니다." | ||
exit 1 | ||
fi | ||
env: | ||
ALL_USERS: ${{ env.ALL_USERS }} |