Skip to content

Commit 675caa0

Browse files
authored
ci: add assign-reviewer job (DaleStudy#529)
* Update .gitignore * ci: add assign-reviewer job - PR 리뷰어를 자동 할당하는 automation job 을 추가합니다. - 리뷰어 찾기 조건 - 현재 PR 보다 이전에 생성된 PR 이어야 함 - Closed PR 은 제외해야 함 (실수로 올렸다 닫는 경우가 종종 있으므로) - 찾은 PR 중 현재 PR과 가장 근접한 PR의 작성자여야 함 - 현재 PR과 다른 이름의 작성자여야 함 * ci: json 파싱시 number 필드 제외 * ci: PR number 비교 처리 변경 * ci: PR 작성자 탐색 조건 수정 * ci: update .gitignore * ci: 주석 수정
1 parent 1cdfe5c commit 675caa0

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

.github/workflows/automation.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,28 @@ jobs:
2424
- uses: actions/labeler@v5
2525
with:
2626
repo-token: ${{ github.token }}
27+
28+
assign-reviewer:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Get previous PR author and assign as reviewer
32+
env:
33+
GITHUB_TOKEN: ${{ github.token }}
34+
run: |
35+
current_repo=${{ github.repository }}
36+
current_pr_num=${{ github.event.number }}
37+
38+
# 이전 PR 중에서 현재 PR 작성자와 다른 작성자 찾기
39+
previous_pr_author=$(gh pr list --repo $current_repo \
40+
--state all \
41+
--search "created:<${{ github.event.pull_request.created_at }} sort:created-desc -author:${{ github.actor }}" \
42+
--limit 3 \
43+
--json number,author \
44+
--jq "map(select(.number < $current_pr_num))[0].author.login")
45+
46+
if [ -n "$previous_pr_author" ]; then
47+
gh pr edit $current_pr_num --repo $current_repo --add-reviewer $previous_pr_author
48+
else
49+
echo "❌ No previous PR author found to assign as reviewer"
50+
exit 1
51+
fi

0 commit comments

Comments
 (0)