Skip to content

Commit 6fb7370

Browse files
authored
Merge pull request #28 Resolve #27
#27 해결 + Secret 세팅 완료
2 parents 8dd00ee + 1f89da0 commit 6fb7370

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Notify Telegram on PR Events
2+
3+
on:
4+
pull_request:
5+
types: [opened, closed]
6+
7+
jobs:
8+
notify:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Send Telegram Message on PR Open
12+
if: github.event_name == 'pull_request' && github.event.action == 'opened'
13+
env:
14+
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
15+
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
16+
PR_TITLE: ${{ github.event.pull_request.title }}
17+
PR_URL: ${{ github.event.pull_request.html_url }}
18+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
19+
run: |
20+
MESSAGE="📢 새로운 PR 등록!%0A%0A제목: $PR_TITLE%0A작성자: $PR_AUTHOR%0A링크: $PR_URL"
21+
curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
22+
-d chat_id="$TELEGRAM_CHAT_ID" \
23+
-d text="$MESSAGE"
24+
25+
- name: Send Telegram Message on PR Approved
26+
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged
27+
env:
28+
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
29+
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
30+
PR_TITLE: ${{ github.event.pull_request.title }}
31+
PR_URL: ${{ github.event.pull_request.html_url }}
32+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
33+
REVIEWER: ${{ github.event.review.user.login }}
34+
run: |
35+
MESSAGE="✅ PR이 병합되었습니다! %0A%0A제목: $PR_TITLE%0A작성자: $PR_AUTHOR%0A리뷰어: $REVIEWER%0A링크: $PR_URL"
36+
curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
37+
-d chat_id="$TELEGRAM_CHAT_ID" \
38+
-d text="$MESSAGE"

0 commit comments

Comments
 (0)