Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughDiscord 알림 시스템을 GitHub Actions에 추가합니다. 새로운 라이브러리는 GitHub 이벤트를 Discord 임베드로 변환하고, 스크립트는 웹훅 URL로 알림을 전송합니다. 워크플로우는 PR, push, issue 이벤트를 트리거하며, 포괄적인 테스트 스위트가 모든 기능을 검증합니다. Changes
Sequence Diagram(s)sequenceDiagram
participant GHA as GitHub Actions
participant Script as discord-notify.mjs
participant Lib as discord-notify-lib.mjs
participant Discord as Discord Webhook
GHA->>Script: Trigger with event context
activate Script
Script->>Script: Load env vars & GitHub event payload
Script->>Lib: resolveEventType(eventName, payload)
activate Lib
Lib-->>Script: Internal event type
deactivate Lib
alt Event is notifiable
Script->>Lib: buildEmbed(eventType, payload, meta)
activate Lib
Lib->>Lib: Call event-specific builder
Lib-->>Script: Discord Embed object
deactivate Lib
Script->>Lib: buildWebhookBody(embed)
activate Lib
Lib-->>Script: Webhook payload
deactivate Lib
Script->>Discord: POST webhook payload
activate Discord
Discord-->>Script: 200 OK
deactivate Discord
Script->>Script: Log success
else Event not notifiable
Script->>Script: Skip notification
end
deactivate Script
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
GitHub Actions 워크플로와 실행 스크립트를 추가하여 특정 GitHub 이벤트 발생 시 Discord Webhook으로 포맷된 Embed 알림을 전송합니다.
이 PR에는 이벤트 판별 로직, Embed 생성 유틸, 실행 스크립트 및 해당 로직을 검증하는 유닛 테스트가 포함되어 있습니다.
.github/workflows/discord-notify.yml워크플로 추가 — PR 머지(closed/merged), 브랜치 생성, push, 이슈 오픈 이벤트를 처리.github/scripts/discord-notify.mjs실행 스크립트 추가 — 이벤트 로드, 판별, Embed 생성 후 Discord Webhook 호출.github/scripts/discord-notify-lib.mjs라이브러리 추가 — 이벤트 타입 해석 및 다양한 Embed 빌더(프리젠테이션 로직).github/scripts/__tests__/discord-notify-lib.spec.mjs단위 테스트 추가 — 빌더 및 이벤트 판별 동작 검증DISCORD_WEBHOOK_URL시크릿과 Node.js v24 환경을 사용Changes
.github/scripts/__tests__/discord-notify-lib.spec.mjsresolveEventType, 각종build*Embed함수 및buildWebhookBody의 동작(색상, 필드, URL, 커밋 요약 등)을 다양한 케이스로 검증합니다..github/scripts/discord-notify-lib.mjsresolveEventType와 Discord Embed 생성 유틸을 추가합니다. 주요 빌더로는buildPrMergedEmbed,buildBranchCreatedEmbed,buildBranchPushEmbed,buildIssueOpenedEmbed가 포함되며,repoLink,authorLink,truncate같은 내부 유틸을 제공합니다..github/scripts/discord-notify.mjsDISCORD_WEBHOOK_URL,GITHUB_EVENT_NAME,GITHUB_EVENT_PATH,GITHUB_REPOSITORY), 이벤트 로드 및 판별, Embed 생성 후 Discord Webhook으로 POST 호출을 수행하며 실패 시 에러를 로깅하고 비정상 종료합니다..github/workflows/discord-notify.ymlDiscord Notify를 추가합니다. 트리거:pull_request(closed),create,push,issues(opened)..github/scripts만 sparse-checkout 하여 워크플로에서 스크립트를 체크아웃하고actions/setup-node@v4로 Node.js(설정:node-version: 24) 환경을 구성한 뒤.github/scripts/discord-notify.mjs를 실행합니다. 실행 시DISCORD_WEBHOOK_URL시크릿을 사용합니다.Impact
DISCORD_WEBHOOK_URL시크릿 설정이 필요합니다.actions/setup-node@v4).Checklist
DISCORD_WEBHOOK_URL가 repository Secrets에 설정되어 있는지 확인하세요.node .github/scripts/discord-notify.mjs를 실행해 webhook 호출이 정상 동작하는지 검증하세요.node실행 환경이 v24인지(또는 호환되는지) 확인하세요 (actions/setup-node@v4설정 검토)..github/scripts/__tests__/discord-notify-lib.spec.mjs)이 CI에서 통과하는지 확인하세요.Dependencies
actions/checkout@v4andactions/setup-node@v4node-version: 24를 요구Summary by CodeRabbit
릴리스 노트
새로운 기능
테스트
자동화