Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore]: 리뷰어 선정 시 슬랙 알림 workflow 적용 #33

Merged
merged 4 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/pr-reviewer-noti.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]
kongnayeon marked this conversation as resolved.
Show resolved Hide resolved

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

@coderabbitai coderabbitai bot Jan 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

액션 버전을 최신으로 업데이트하세요

보안 및 성능 향상을 위해 최신 버전의 액션을 사용하는 것이 좋습니다.

-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
-        uses: actions/github-script@v6
+        uses: actions/github-script@v7

Also applies to: 15-15

🧰 Tools
🪛 actionlint (1.7.4)

11-11: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요것만 한 번 확인해 주셔요!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kongnayeon 해당 버전 업데이트(actions/checkout@v4, actions/github-script@v7)으로 보안과 성능이 개선되니 적용하시면 좋을 것 같습니다. 추가 궁금한 사항 있으시면 언제든 말씀 부탁드립니다!


- 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 }}
kongnayeon marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions .github/workflows/reviewer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"minseong0324": "U083UEXJLLC",
"kongnayeon": "U083BDHR279"
}
Loading