|
| 1 | +name: PR Notifications |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [closed] # 'closed'로 통합해 처리 |
| 6 | + |
| 7 | +jobs: |
| 8 | + notify-discord: |
| 9 | + runs-on: ubuntu-22.04 |
| 10 | + |
| 11 | + steps: |
| 12 | + # Merge 상태 및 PR 제목 출력 (디버깅용) |
| 13 | + - name: Check PR Details |
| 14 | + run: | |
| 15 | + echo "github.event.pull_request.merged : ${{ github.event.pull_request.merged }}" |
| 16 | + echo "The PR title is ${{ github.event.pull_request.title }}" |
| 17 | +
|
| 18 | + # 타임스탬프 생성 |
| 19 | + - name: Format Timestamp |
| 20 | + run: | |
| 21 | + echo "TIMESTAMP=$(TZ=Asia/Seoul date '+%Y.%m.%d(%a)')" >> $GITHUB_ENV |
| 22 | +
|
| 23 | + # PR이 Merged 상태일 때 Discord 알림 전송 |
| 24 | + - name: Notify Discord for Merged PR |
| 25 | + if: ${{ github.event.pull_request.merged == true }} |
| 26 | + uses: johnnyhuy/actions-discord-git-webhook@main |
| 27 | + with: |
| 28 | + webhook_url: ${{ secrets.DISCORD_WEBHOOK }} |
| 29 | + args: | |
| 30 | + 👾 **GitHub PR 발생** 👾 |
| 31 | + **Status**: Merged |
| 32 | + **Title**: ${{ github.event.pull_request.title }} |
| 33 | + **Author**: ${{ github.actor }} |
| 34 | + **Repository**: ${{ github.repository }} |
| 35 | + **Branch**: ${{ github.ref_name }} |
| 36 | + **Commit**: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) |
| 37 | + **Link**: ${{ github.event.pull_request.html_url }} |
| 38 | + --- |
| 39 | + ⌚️ **Timestamp**: ${{ env.TIMESTAMP }} |
| 40 | +
|
| 41 | + # PR이 Merged 상태가 아닐 때 (Closed) Discord 알림 전송 |
| 42 | + - name: Notify Discord for Closed PR |
| 43 | + if: ${{ github.event.pull_request.merged != true }} |
| 44 | + uses: johnnyhuy/actions-discord-git-webhook@main |
| 45 | + with: |
| 46 | + webhook_url: ${{ secrets.DISCORD_WEBHOOK }} |
| 47 | + args: | |
| 48 | + 👾 **GitHub PR 발생** 👾 |
| 49 | + **Status**: Closed |
| 50 | + **Title**: ${{ github.event.pull_request.title }} |
| 51 | + **Author**: ${{ github.actor }} |
| 52 | + **Repository**: ${{ github.repository }} |
| 53 | + **Branch**: ${{ github.ref_name }} |
| 54 | + **Commit**: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) |
| 55 | + **Link**: ${{ github.event.pull_request.html_url }} |
| 56 | + --- |
| 57 | + ⌚️ **Timestamp**: ${{ env.TIMESTAMP }} |
0 commit comments