diff --git a/.github/workflows/deploy_executables.yml b/.github/workflows/deploy_executables.yml index a9339ce..810f485 100644 --- a/.github/workflows/deploy_executables.yml +++ b/.github/workflows/deploy_executables.yml @@ -6,8 +6,26 @@ on: types: [published] jobs: + # ================================== + # 1. 파이프라인 시작 알림 + # ================================== + start: + runs-on: ubuntu-latest + steps: + - name: Send Pipeline Start Notification + run: | + curl -X POST -H "Content-Type: application/json" \ + -d '{ + "username": "AI 배포 봇", + "embeds": [{ + "description": "**${{ github.ref_name }}** AI 배포를 시작합니다.", + "color": 2243312 + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK_URL }} # 1단계: 각 OS에서 실행 파일을 빌드하는 잡 build: + needs: start strategy: matrix: os: [macos-latest, windows-latest] @@ -59,6 +77,7 @@ jobs: with: name: executable-${{ runner.os }} path: dist/${{ env.EXE_NAME }} + # 2단계: 빌드된 실행 파일들을 Front 레포지토리에 배포하는 잡 deploy: # build 잡이 성공해야 실행됨 @@ -101,3 +120,57 @@ jobs: git commit -m "feat: AI 실행 파일 업데이트 (${{ github.ref_name }})" git push fi + + # ================================== + # 파이프라인 최종 결과 알림 + # ================================== + finish: + needs: deploy + runs-on: ubuntu-latest + if: always() + + steps: + - name: Send Success Notification + if: needs.deploy.result == 'success' + run: | + curl -X POST -H "Content-Type: application/json" \ + -d '{ + "username": "AI 배포 봇", + "embeds": [{ + "title": "New AI Release: ${{ github.ref_name }}", + "url": "${{ github.event.release.html_url }}", + "description": "**${{ github.ref_name }}** AI 배포가 성공적으로 완료되었습니다!", + "color": 5167473 + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK_URL }} + + - name: Send Failure Notification + if: contains(needs.*.result, 'failure') + run: | + curl -X POST -H "Content-Type: application/json" \ + -d '{ + "username": "AI 배포 봇", + "embeds": [{ + "title": "AI 배포 실패", + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", + "description": "**${{ github.ref_name }}** AI 배포 중 오류가 발생했습니다.", + "color": 15219495 + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK_URL }} + + - name: Send Skipped or Cancelled Notification + if: contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') + run: | + curl -X POST -H "Content-Type: application/json" \ + -d '{ + "username": "AI 배포 봇", + "embeds": [{ + "title": "AI 배포 미완료", + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", + "description": "**${{ github.ref_name }}** AI 배포가 완료되지 않았습니다. (상태: 취소 또는 건너뜀)\n이전 단계에서 문제가 발생했을 수 있습니다.", + "color": 16577629 + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK_URL }} diff --git a/.github/workflows/pr_bot.yml b/.github/workflows/pr_bot.yml new file mode 100644 index 0000000..22daee4 --- /dev/null +++ b/.github/workflows/pr_bot.yml @@ -0,0 +1,86 @@ +# .github/workflows/pr_bot.yml +name: Pull Request Bot + +on: + # Pull Request 관련 이벤트 발생 시 + pull_request: + types: [opened, closed, reopened, synchronize] + issue_comment: + types: [created] + +jobs: + notify: + runs-on: ubuntu-latest + steps: + # ------------------------- + # 생성/동기화 알림 + # ------------------------- + - name: Send PR Created Notification + if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') + run: | + curl -X POST -H "Content-Type: application/json" \ + -d '{ + "username": "GitHub PR 봇", + "embeds": [{ + "title": "Pull Request #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}", + "description": "**${{ github.actor }}**님이 Pull Request를 생성하거나 업데이트했습니다.", + "url": "${{ github.event.pull_request.html_url }}", + "color": 2243312 + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK_URL }} + + # ------------------------- + # 댓글 알림 + # ------------------------- + - name: Send PR Comment Notification + if: github.event_name == 'issue_comment' && github.event.issue.pull_request + run: | + COMMENT_BODY=$(echo "${{ github.event.comment.body }}" | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g') + curl -X POST -H "Content-Type: application/json" \ + -d "{ + \"username\": \"GitHub 댓글 봇\", + \"embeds\": [{ + \"title\": \"New Comment on PR #${{ github.event.issue.number }}\", + \"description\": \"**${{ github.actor }}**님의 새 댓글: \\n${COMMENT_BODY}\", + \"url\": \"${{ github.event.comment.html_url }}\", + \"color\": 15105570 + }] + }" \ + ${{ secrets.DISCORD_WEBHOOK_URL }} + + # ------------------------- + # 머지(Merge) 알림 + # ------------------------- + - name: Send PR Merged Notification + if: github.event.action == 'closed' && github.event.pull_request.merged == true + run: | + curl -X POST -H "Content-Type: application/json" \ + -d '{ + "username": "GitHub Merge 봇", + "embeds": [{ + "title": "Pull Request #${{ github.event.pull_request.number }} Merged!", + "description": "**${{ github.actor }}**님이 **${{ github.event.pull_request.title }}** PR을 머지했습니다.", + "url": "${{ github.event.pull_request.html_url }}", + "color": 5167473 + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK_URL }} + + # ------------------------- + # 닫힘(Close) 알림 + # ------------------------- + - name: Send PR Closed Notification + if: github.event.action == 'closed' && github.event.pull_request.merged == false + run: | + curl -X POST -H "Content-Type: application/json" \ + -d '{ + "username": "GitHub PR 봇", + "embeds": [{ + "title": "Pull Request #${{ github.event.pull_request.number }} Closed", + "description": "**${{ github.actor }}**님이 **${{ github.event.pull_request.title }}** PR을 닫았습니다.", + "url": "${{ github.event.pull_request.html_url }}", + "color": 15219495 + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK_URL }}