Skip to content

[CI] 디스코드 알림 제목 포맷 개선 및 review_requested 이벤트 추가#29

Merged
ehye1 merged 4 commits into
developfrom
ci/root/28-discord-notification-enhancement
Jun 26, 2026
Merged

[CI] 디스코드 알림 제목 포맷 개선 및 review_requested 이벤트 추가#29
ehye1 merged 4 commits into
developfrom
ci/root/28-discord-notification-enhancement

Conversation

@ehye1

@ehye1 ehye1 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

ISSUE 🔗

close #28



What is this PR? 🔍

디스코드 알림 워크플로우의 메시지 품질을 전반적으로 개선했습니다. 알림 제목을 한국어로 전환하고, GitHub 계정명을 팀원 이름으로 매핑하며, PR·이슈 제목과 라벨·리뷰어 정보를 embed에 노출합니다. review_requested·ready_for_review 이벤트를 추가해 알림 커버리지를 확장했고, 보안 및 안정성 버그도 함께 수정했습니다.

배경

  • 기존 구조: 알림 제목이 [PR], [PR Review] 등 영문 prefix로만 표시되고, author가 GitHub ID 그대로 노출되는 구조였습니다.
  • 발생 문제: 디스코드 채널에서 누가 어떤 행동을 했는지 직관적으로 파악하기 어려웠고, 리뷰 요청 시 알림이 전송되지 않아 응답이 늦어지는 문제가 있었습니다.
  • 해결 방향: 이벤트·액션별 한국어 제목 부여, resolve_name 함수로 팀원 이름 매핑, review_requested 이벤트 추가, 보안·안정성 개선을 순차적으로 진행했습니다.

알림 제목 한국어화

  • 변경 요약: 이벤트·액션 조합마다 한국어 제목을 부여했습니다.
  • 이유: [PR] Fix something 형태로는 opened·merged·closed를 구분하기 어려웠습니다.
  • 구현 방식: ACTION 변수 분기를 통해 PR이 열렸습니다, PR이 머지됐습니다, 리뷰 요청이 왔습니다 등 상태별로 제목을 다르게 설정했습니다. review state(approved / changes_requested)도 같은 방식으로 분기했습니다.

팀원 이름 매핑

  • 변경 요약: GitHub 계정명을 팀원 한국어 이름으로 변환하는 resolve_name 함수를 추가했습니다.
  • 이유: 디스코드 알림에 ehye1, kimminna 등 GitHub ID가 그대로 노출돼 가독성이 낮았습니다.
  • 구현 방식: bash case 문으로 계정명을 매핑하며, 매핑되지 않은 계정은 원래 ID를 그대로 반환합니다. avatar 이미지 URL은 원본 GitHub ID를 유지합니다.

본문 포맷 개선

  • 변경 요약: PR·이슈 제목을 description 최상단에 굵게 표시하고, 본문 보일러플레이트를 제거하는 clean_body 함수를 추가했습니다.
  • 이유: 기존에는 제목이 embed title에만 노출돼 본문만 보면 어떤 PR인지 파악하기 어려웠고, close #28 같은 boilerplate가 그대로 노출됐습니다.
  • 구현 방식: clean_body<br>, 헤더(#), close/fix/resolve #숫자 패턴, 빈 줄을 제거한 뒤 200자로 자릅니다. DESC는 **$PR_TITLE**\n$CLEAN_BODY 형태로 구성합니다.

라벨·리뷰어 fields 표시

  • 변경 요약: PR·이슈의 라벨과 review_requested 시 리뷰어를 embed fields로 표시했습니다.
  • 이유: 라벨 없이는 알림만으로 어떤 종류의 작업인지 파악하기 어려웠습니다.
  • 구현 방식: build_fields 함수가 labels, reviewer 문자열을 받아 fields JSON 배열을 동적으로 구성합니다. 값이 비어 있으면 해당 field는 추가하지 않습니다. 팀 리뷰 요청(requested_team)도 처리합니다.

review_requested 이벤트 추가

  • 변경 요약: pull_request.typesreview_requested, ready_for_review를 추가하고 핸들링 로직을 구현했습니다.
  • 이유: 리뷰 요청이 와도 알림이 전송되지 않아 리뷰어가 요청을 인지하지 못하는 경우가 있었습니다.
  • 구현 방식: review_requestedrequested_reviewer.login을 파싱해 resolve_name으로 변환 후 리뷰어 field로 노출합니다. 개인이 아닌 팀 리뷰 요청은 requested_team.name으로 fallback합니다.

보안·안정성 개선

  • 변경 요약: EVENT_NAME·ACTIONenv로 이동하고, grep 오류 방지를 추가했습니다.
  • 이유: ${{ github.event_name }}을 shell 스크립트에 직접 인라인하면 스크립트 인젝션 위험이 있습니다. 또한 grep이 매칭 없을 때 exit code 1을 반환해 set -e 환경에서 스크립트가 조기 종료되는 문제가 있었습니다.
  • 구현 방식: GitHub context 값을 env: 블록으로 주입하고 shell에서 환경변수로 참조합니다. grep 파이프라인 끝에 || true를 추가해 매칭 없는 경우도 정상 처리합니다.



To Reviewers

ready_for_review 이벤트는 Draft → 리뷰 준비 완료 전환 시 발생하며, 현재는 PR이 열렸을 때와 동일한 색상을 사용하고 있습니다.



Screenshot 📷



Test Checklist ✔

  • review_requested 이벤트 실제 발송 확인
  • PR 머지·닫힘·열림 알림 한국어 제목 확인
  • 라벨 없는 PR에서 라벨 field가 노출되지 않는지 확인
  • 팀 리뷰 요청 시 requested_team.name 노출 확인

- 이벤트별 알림 제목을 한국어로 변경했습니다
- GitHub 계정명을 팀원 이름으로 매핑하는 resolve_name 함수를 추가했습니다
- PR·이슈 라벨과 리뷰어를 embed fields로 표시했습니다
- review_requested, ready_for_review 이벤트 핸들링을 추가했습니다
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

pull_request 알림 범위가 review_requestedready_for_review까지 넓어졌고, Discord 임베드는 이벤트별 제목·색상·본문·필드 규칙으로 다시 구성됐습니다. 작성자 아바타, footer, 전송 구문도 함께 조정됐습니다.

Changes

디스코드 알림 워크플로우

Layer / File(s) Summary
트리거와 입력 주입
.github/workflows/discord-notification.yml
pull_request 트리거에 review_requested, ready_for_review가 추가되고, 알림 단계에 EVENT_NAMEACTION이 주입됩니다.
임베드 생성 규칙
.github/workflows/discord-notification.yml
resolve_name, clean_body, build_fields로 PR·리뷰·코멘트·이슈의 제목, 색상, 본문, 필드 구성이 재정의됩니다.
작성자 아바타와 전송 형식
.github/workflows/discord-notification.yml
author.icon_urlavatar_user 기반으로 바뀌고, footer 텍스트와 curl 호출 형식이 변경됩니다.

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant SendDetailedDiscordMessage
  participant DiscordWebhook
  GitHubActions->>SendDetailedDiscordMessage: pull_request / pull_request_review / pull_request_review_comment 이벤트 전달
  SendDetailedDiscordMessage->>SendDetailedDiscordMessage: resolve_name / clean_body / build_fields 적용
  SendDetailedDiscordMessage->>DiscordWebhook: 임베드 POST 전송
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Team-Timo/Timo-client#11 — 같은 discord-notification.yml에서 Discord 알림 payload와 이벤트 처리 로직을 변경했습니다.

Suggested reviewers

  • kimminna
  • jjangminii
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 디스코드 알림 한국어화와 review_requested 이벤트 추가라는 핵심 변경을 잘 요약합니다.
Linked Issues check ✅ Passed 제목 한국어화, 이름 매핑, 라벨/리뷰어 노출, review_requested 처리 등 링크된 이슈의 핵심 요구를 충족합니다.
Out of Scope Changes check ✅ Passed 워크플로우 알림 개선 범위 안의 변경만 보이며, 목표와 무관한 별도 기능 추가는 보이지 않습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed 설명이 디스코드 알림 워크플로우 개선, 한국어 제목화, 이름 매핑, review_requested 추가 등 변경사항과 잘 맞습니다.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/root/28-discord-notification-enhancement

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added 😎 DevOps CI/CD, 자동화, 개발 파이프라인 관리 ♥️ 혜원 혜원양 labels Jun 26, 2026
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

📦 번들 사이즈 리포트

🕐 Timo Web

라우트 크기 First Load JS 상태
/ 0 B 128.40 kB 🟢
/login 0 B 128.40 kB 🟢
/signup 0 B 128.40 kB 🟢

공유 번들: 128.40 kB


🟢 정상 (<200kB) 🟡 주의 (<350kB) 🔴 초과 (≥350kB) — First Load JS 기준 (gzip 크기)

빌드 커밋: 290aee1

@ehye1 ehye1 changed the title [CI] 디스코드 알림 제목 한국어화·이름 매핑·라벨 표시·review_requested 추가 [CI] 디스코드 알림 제목 포맷 개선 및 review_requested 이벤트 추가 Jun 26, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/discord-notification.yml:
- Around line 46-47: `COLOR_BLUE` in the Discord notification workflow is mapped
to a magenta value instead of blue, so update the constant used for the PR-open
notification to a real blue and keep the `COLOR_BLUE` label/comment aligned with
its meaning. Verify the color constants in the workflow block that defines
`COLOR_GREEN`, `COLOR_BLUE`, and the other status colors so the notification
styling matches each event consistently.
- Around line 15-17: The discord-notification job is granting unnecessary GitHub
token permissions even though it only reads $GITHUB_EVENT_PATH with jq and posts
to Discord. Update the job’s permissions block in the discord-notification
workflow to use an empty permissions object, or explicitly document any retained
scope with a comment if you decide not to remove it. Use the job-level
permissions section in the discord-notification workflow to locate the change.
- Around line 69-70: The workflow step currently assigns GitHub event values
inside the run script, which should be moved into the step’s env block for
cleaner and safer handling. Update the discord notification job so EVENT_NAME
and ACTION are injected via env using github.event_name and github.event.action,
then reference those shell variables in the script instead of embedding
expressions directly in the run block. Use the existing discord-notification
workflow step context to locate the assignment and keep the script logic
otherwise unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 75157f9d-1432-43ab-a35f-21b789b43a24

📥 Commits

Reviewing files that changed from the base of the PR and between 14b6200 and 65aa267.

📒 Files selected for processing (1)
  • .github/workflows/discord-notification.yml

Comment thread .github/workflows/discord-notification.yml Outdated
Comment thread .github/workflows/discord-notification.yml Outdated
Comment thread .github/workflows/discord-notification.yml Outdated
ehye1 added 2 commits June 26, 2026 10:18
- PR·이슈 제목을 description 최상단에 굵게 표시하도록 DESC 구조를 변경했습니다
- 본문 보일러플레이트(헤더, close # 등)를 제거하는 clean_body 함수를 추가했습니다
- EVENT_NAME·ACTION을 env로 이동해 스크립트 인젝션 위험을 제거했습니다
- 불필요한 permissions를 제거했습니다
- 색상 변수명을 의미 기반(COLOR_SUCCESS, COLOR_OPEN 등)으로 변경했습니다

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/discord-notification.yml:
- Around line 55-61: The body-cleaning step in the Discord notification workflow
can exit early when `grep -vE` removes every line under `set -euo pipefail`,
causing `clean_body` to fail instead of returning an empty message. Update the
`clean_body` pipeline in the workflow to treat the “no matching lines” case as
success and return an empty string, so PR bodies containing only template
headers or `close `#123`` still allow the notification job to continue.
- Around line 107-108: `REVIEWER` is only populated from
`.requested_reviewer.login`, so team review requests end up blank in the Discord
notification flow. Update the review-request parsing in the workflow to fall
back to `requested_team.name` (and `slug` if needed) before calling
`resolve_name`, so team-assigned reviewers are surfaced too. Keep the change
localized to the existing `RAW_REVIEWER`/`REVIEWER` extraction logic in the
notification step.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 582c605c-8155-4dee-8125-370c1882aa42

📥 Commits

Reviewing files that changed from the base of the PR and between 65aa267 and 939a30e.

📒 Files selected for processing (1)
  • .github/workflows/discord-notification.yml

Comment thread .github/workflows/discord-notification.yml
Comment thread .github/workflows/discord-notification.yml Outdated
- grep이 매칭 없을 때 set -e로 인해 스크립트가 종료되는 문제를 || true로 수정했습니다
- review_requested 시 팀 리뷰 요청(requested_team)도 처리하도록 추가했습니다

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
.github/workflows/discord-notification.yml (1)

57-57: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

|| truegrep 단계에만 묶어 주세요.

현재는 grep이 한 줄이라도 남기면 뒤의 빈 줄 제거·한 줄 변환·200자 제한이 전부 건너뛰어집니다. grep 실패만 정상화하도록 그룹으로 감싸면 의도대로 동작합니다. 참고로 Bash 공식 매뉴얼의 Pipelines/Lists 우선순위도 함께 확인해 주세요.

🛠️ 제안 수정
           clean_body() {
-            echo "$1" \
+            printf '%s\n' "$1" \
               | sed 's/<br>//gi' \
-              | grep -vE '^\s*(#|close[sd]? #[0-9]+|fixes? #[0-9]+|resolves? #[0-9]+)' || true \
+              | { grep -vE '^\s*(#|close[sd]? #[0-9]+|fixes? #[0-9]+|resolves? #[0-9]+)' || true; } \
               | sed '/^\s*$/d' \
               | tr '\n' ' ' \
               | sed 's/  */ /g' \
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/discord-notification.yml at line 57, Normalize only the
grep failure in the Discord notification pipeline by grouping the grep step in
the workflow so that || true applies to grep alone, not to the rest of the
cleanup chain. Update the pipeline in discord-notification.yml around the
grep-vE filter so the subsequent empty-line removal, single-line conversion, and
200-character truncation still run when grep succeeds. Use the existing shell
pipeline in this job as the target and preserve the current filtering logic
while fixing the operator precedence.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In @.github/workflows/discord-notification.yml:
- Line 57: Normalize only the grep failure in the Discord notification pipeline
by grouping the grep step in the workflow so that || true applies to grep alone,
not to the rest of the cleanup chain. Update the pipeline in
discord-notification.yml around the grep-vE filter so the subsequent empty-line
removal, single-line conversion, and 200-character truncation still run when
grep succeeds. Use the existing shell pipeline in this job as the target and
preserve the current filtering logic while fixing the operator precedence.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 12530461-3a22-4607-8015-12d97b13e191

📥 Commits

Reviewing files that changed from the base of the PR and between 6fe9a02 and 6fabd5e.

📒 Files selected for processing (1)
  • .github/workflows/discord-notification.yml

@kimminna kimminna left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

고생했어요!

바뀐 포맷으로 알림 오면 더 깔끔하고 좋을 것 같아요~~ 😍👍

@jjangminii jjangminii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

알림 제목 한국어화부터 팀원 이름 매핑, 보안 개선까지 꼼꼼하게 챙겨주셨네요 👍 디스코드 알림이 훨씬 읽기 편해질 것 같아요!

@yumin-kim2 yumin-kim2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Discord 알림이 더 읽기 쉬워질 것 같아서 설레네요 너무 편리하고 깔끔한 것 같아요! 보안 버그 수정까지...👍👍
수고하셨습니다~~

@ehye1 ehye1 merged commit 3243fe0 into develop Jun 26, 2026
21 checks passed
@kimminna kimminna deleted the ci/root/28-discord-notification-enhancement branch June 26, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♥️ 혜원 혜원양 😎 DevOps CI/CD, 자동화, 개발 파이프라인 관리

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] 디스코드 알림 제목 포맷 개선 및 review_requested 이벤트 추가

4 participants