Skip to content

Commit 39bedc8

Browse files
committedAug 17, 2024·
[feat/cicd] discord 채널에 해당 메시지가 적절하게 보이도록 수정

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed
 

‎.github/workflows/discord-pr.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ jobs:
1414
- name: Discord Notification
1515
env:
1616
DISCORD_WEBHOOK: ${{ secrets.DISCORD_PR_WEBHOOK }}
17+
DISCORD_USERNAME: GitHub
18+
DISCORD_AVATAR: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
1719
uses: Ilshidur/action-discord@master
1820
with:
19-
args: '새로운 PR이 열렸습니다! @이광훈 @배지훈 \nPR: ${{ github.event.pull_request.html_url }}\n작성자: ${{ github.event.pull_request.user.login }}\n제목: ${{ github.event.pull_request.title }}'
21+
args: |
22+
새로운 PR이 열렸습니다! <@lkhoony> <@baezzy1789>
23+
PR: ${{ github.event.pull_request.html_url }}
24+
작성자: ${{ github.event.pull_request.user.login }}
25+
제목: ${{ github.event.pull_request.title }}

‎.github/workflows/main.yml

+24-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ jobs:
99
steps:
1010
- name: Checkout source code
1111
uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Get commit message and author
16+
id: get_commit_info
17+
run: |
18+
echo "::set-output name=message::$(git log --format=%s -n 1)"
19+
echo "::set-output name=author::$(git log --format=%an -n 1)"
20+
echo "::set-output name=author_username::$(git log --format=%ae -n 1 | cut -d@ -f1)"
1221
1322
- name: Install dependencies
1423
run: yarn install
@@ -29,17 +38,30 @@ jobs:
2938
if: steps.deploy.outcome == 'success'
3039
env:
3140
DISCORD_WEBHOOK: ${{ secrets.DISCORD_DEPLOY_WEBHOOK }}
41+
DISCORD_USERNAME: GitHub
42+
DISCORD_AVATAR: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
3243
uses: Ilshidur/action-discord@master
3344
with:
34-
args: "🎉 배포가 성공적으로 완료되었습니다! 브랜치: develop"
45+
args: |
46+
🎉 배포가 성공적으로 완료되었습니다!
47+
브랜치: develop
48+
커밋: ${{ steps.get_commit_info.outputs.message }}
49+
작성자: ${{ steps.get_commit_info.outputs.author }}
3550
3651
- name: Discord notification - Failure
3752
if: steps.deploy.outcome == 'failure'
3853
env:
3954
DISCORD_WEBHOOK: ${{ secrets.DISCORD_DEPLOY_WEBHOOK }}
55+
DISCORD_USERNAME: GitHub
56+
DISCORD_AVATAR: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
4057
uses: Ilshidur/action-discord@master
4158
with:
42-
args: "❌ 배포 중 오류가 발생했습니다. 브랜치: develop"
59+
args: |
60+
❌ 배포 중 오류가 발생했습니다.
61+
브랜치: develop
62+
커밋: ${{ steps.get_commit_info.outputs.message }}
63+
작성자: <@${{ steps.get_commit_info.outputs.author_username }}>
64+
실패한 워크플로우: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
4365
4466
- name: Check deploy result
4567
if: steps.deploy.outcome == 'failure'

0 commit comments

Comments
 (0)
Please sign in to comment.