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

[FIX] Notification 관련 CI workflow 에러 해결 #144

Merged
merged 7 commits into from
Aug 23, 2024

Conversation

kssumin
Copy link
Contributor

@kssumin kssumin commented Aug 22, 2024

📌 관련 이슈

closed #142

✒️ 작업 내용

PR 발생 시 알람 CI

  • 기존 pr-notification ci에서는 SLACK_IDS값(깃허브 - slack member id를 key-value로 연관지은 값)을 json형태로 관리하고 있습니다.
  • 하지만 CI에서 해당 값을 불러올 때 json으로 명확하게 불러오지 않아서 에러가 발생한 것 같아 toJSON을 통해 명시적으로 json으로 변환했습니다.
  • 추가적으로 assingees, reviewers를 지정할 떄 해당 멤버를 슬랙에서 태그하도록 했습니다.

리뷰 발생 시 알람 CI

리뷰가 발생했을 때 CI도 추가해두었습니다.

스크린샷 🏞️ (선택)

image

💬 REVIEWER에게 요구사항 💬

현재 backend-ci가 통과하지 않을 것입니다(이는 #143 이슈에서 해결합니다.)
따라서 notification 관련 CI만 해당 PR에서 통과하면 merge 해도 될 것 같습니다!

@kssumin kssumin added the bug Something isn't working label Aug 22, 2024
@kssumin kssumin self-assigned this Aug 22, 2024
Copy link

github-actions bot commented Aug 22, 2024

Unit Test Results

0 tests  ±0   0 ✔️ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ±0 

Results for commit 267ab3e. ± Comparison against base commit 4ad5a26.

♻️ This comment has been updated with latest results.

@kssumin kssumin closed this Aug 22, 2024
@kssumin kssumin reopened this Aug 22, 2024
@kssumin kssumin closed this Aug 23, 2024
@kssumin kssumin reopened this Aug 23, 2024
Comment on lines +31 to +59

get_slack_id() {
local github_username="$1"
echo "$SLACK_IDS_JSON" | jq -r --arg user "$github_username" '.[$user] // empty'
}

author_slack_id=$(get_slack_id "$PR_AUTHOR")
reviewer_slack_id=$(get_slack_id "$REVIEWER")

if [ -n "$author_slack_id" ]; then
author_mention="<@$author_slack_id>"
else
author_mention="$PR_AUTHOR"
echo "Warning: No Slack ID found for PR author $PR_AUTHOR" >&2
fi

if [ -n "$reviewer_slack_id" ]; then
reviewer_mention="<@$reviewer_slack_id>"
else
reviewer_mention="$REVIEWER"
echo "Warning: No Slack ID found for reviewer $REVIEWER" >&2
fi

case "$REVIEW_STATE" in
"changes_requested")
message="$author_mention님, $reviewer_mention님이 PR에 변경을 요청했습니다: <$PR_URL|$PR_TITLE>"
;;
"commented")
message="$author_mention님, $reviewer_mention님이 PR에 댓글을 달았습니다: <$PR_URL|$PR_TITLE>"
Copy link
Contributor

Choose a reason for hiding this comment

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

엄청난 양의 shell Script...대단해요!

@kssumin kssumin merged commit 5d93087 into develop Aug 23, 2024
3 of 5 checks passed
@kssumin kssumin deleted the MD/fix/142/fix-notification branch August 24, 2024 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FIX] 실패하는 PR_REVIEWER CI를 통과시킨다.
2 participants