Skip to content

Commit

Permalink
�chore: PR 리뷰어 선정 시 Slack 연동, CodeRabbit AI PR 리뷰 설정 워크플로우 추가해요.
Browse files Browse the repository at this point in the history
  • Loading branch information
minseong0324 committed Jan 1, 2025
1 parent 9883d11 commit 4d9240d
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/code-rabbit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: AI-based PR Reviewer with CodeRabbit

on:
pull_request:
types: [opened, synchronize]

jobs:
ai_pr_reviewer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: CodeRabbit AI Review
uses: coderabbitai/[email protected]
with:
language: 'ko'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67 changes: 67 additions & 0 deletions .github/workflows/pr-reviewer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: PR Reviewer Notification

on:
pull_request:
types: [review_requested]

jobs:
specific_review_requested:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Get Reviewers List
id: reviewers
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const workers = JSON.parse(fs.readFileSync('.github/workflows/reviewers.json'));
const mention = context.payload.pull_request.requested_reviewers.map((user) => {
const login = user.login;
const mappedValue = workers[login];
return mappedValue ? <@${mappedValue}> : No mapping found for ${login};
});
return mention.join(', ');
result-encoding: string

- name: Send Slack Notification
id: slack_notification
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.PR_NOTI_CHANNEL }}
payload: |
{
"text": "pr review request",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "리뷰어로 할당되었습니다.\n • 제목: ${{ github.event.pull_request.title }}\n • 리뷰어: ${{ steps.reviewers.outputs.result }}\n • 링크: <${{ github.event.pull_request.html_url }}|리뷰하러 가기>"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.PR_BOT_TOKEN }}

- name: Comment on Slack Thread
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.PR_NOTI_CHANNEL }}
payload: |
{
"text": "PR 코멘트 알림",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "| *작성자*: @${{ github.event.comment.user.login }}\n| *코멘트 내용*: _${{ github.event.comment.body }}_\n| *관련 PR*: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.PR_BOT_TOKEN }}
4 changes: 4 additions & 0 deletions .github/workflows/reviewers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"minseong0324": "U083UEXJLLC",
"kongnayeon": "U083BDHR279"
}

0 comments on commit 4d9240d

Please sign in to comment.