Skip to content

Commit

Permalink
[FIX] 디스코드 알림 기능 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
leegwichan authored Dec 27, 2024
1 parent 09287ab commit b6bf707
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/PR_Comment_Notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
steps:
- name: Set Environment Variables
run: |
echo "AVATAR_URL=${{ secrets.DISCORD_AVATAR_URL }}" >> $GITHUB_ENV
echo "USERNAME=디코봇" >> $GITHUB_ENV
echo "WEB_HOOK=${{ secrets.DISCORD_WEB_HOOK }}" >> $GITHUB_ENV
- name: Set Environment Variables for PR Comments
Expand All @@ -24,8 +22,8 @@ jobs:
echo "PR_URL=${{ github.event.issue.pull_request.html_url }}" >> $GITHUB_ENV
echo "AUTHOR_URL=${{ github.event.comment.user.avatar_url }}" >> $GITHUB_ENV
echo "CONTENT=$(echo '${{ github.event.comment.body }}' | base64 -w 0)" >> $GITHUB_ENV
echo "COMMENT_BODY=${{ github.event.issue.title }}" >> $GITHUB_ENV
echo "TITLE=Pull Request" >> $GITHUB_ENV
echo "TITLE=${{ github.event.issue.title }}" >> $GITHUB_ENV
echo "COMMENT_BODY=Pull Request" >> $GITHUB_ENV
- name: Set Environment Variables for PR Review Comment
if: ${{ contains(github.event.review.body, '/noti') }}
Expand All @@ -34,8 +32,8 @@ jobs:
echo "PR_URL=${{ github.event.pull_request.html_url }}" >> $GITHUB_ENV
echo "AUTHOR_URL=${{ github.event.review.user.avatar_url }}" >> $GITHUB_ENV
echo "CONTENT=$(echo '${{ github.event.review.body }}' | base64 -w 0)" >> $GITHUB_ENV
echo "COMMENT_BODY=${{ github.event.pull_request.title }}" >> $GITHUB_ENV
echo "TITLE=Pull Request" >> $GITHUB_ENV
echo "TITLE=${{ github.event.pull_request.title }}" >> $GITHUB_ENV
echo "COMMENT_BODY=Pull Request" >> $GITHUB_ENV
- name: Set Environment Variables for Issue
if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/noti') }}
Expand All @@ -44,8 +42,8 @@ jobs:
echo "PR_URL=${{ github.event.issue.html_url }}" >> $GITHUB_ENV
echo "AUTHOR_URL=${{ github.event.comment.user.avatar_url }}" >> $GITHUB_ENV
echo "CONTENT=$(echo '${{ github.event.comment.body }}' | base64 -w 0)" >> $GITHUB_ENV
echo "COMMENT_BODY=${{ github.event.issue.title }}" >> $GITHUB_ENV
echo "TITLE=Issue" >> $GITHUB_ENV
echo "TITLE=${{ github.event.issue.title }}" >> $GITHUB_ENV
echo "COMMENT_BODY=Issue" >> $GITHUB_ENV
- name : Set Discord Content
if: ${{ env.CONTENT }}
Expand All @@ -71,9 +69,7 @@ jobs:
- name: Notify Discord
if: ${{ env.COMMENT_AUTHOR && env.PR_URL && env.AUTHOR_URL && env.DISCORD_CONTENT && env.COMMENT_BODY }}
env:
AVATAR_URL: ${{ env.AVATAR_URL }}
COMMENT_BODY: ${{ env.COMMENT_BODY }}
USERNAME: ${{ env.USERNAME }}
WEB_HOOK: ${{ env.WEB_HOOK }}
COMMENT_AUTHOR: ${{ env.COMMENT_AUTHOR }}
PR_URL: ${{ env.PR_URL }}
Expand All @@ -86,8 +82,6 @@ jobs:
JSON_PAYLOAD=$(jq -n \
--arg content "$CONTENT_DECODED" \
--arg description "$COMMENT_BODY" \
--arg username "$USERNAME" \
--arg avatar_url "$AVATAR_URL" \
--arg title "$TITLE" \
--arg url "$PR_URL" \
--arg author_url "$AUTHOR_URL" \
Expand All @@ -96,8 +90,8 @@ jobs:
--arg timestamp "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
'{
content: $content,
username: $username,
avatar_url: $avatar_url,
username: $author_name,
avatar_url: $author_url,
allowed_mentions: {
parse: ["users", "roles"]
},
Expand Down

0 comments on commit b6bf707

Please sign in to comment.