diff --git a/.github/workflows/discord-notify.yml b/.github/workflows/discord-notify.yml new file mode 100644 index 0000000..8fb59ea --- /dev/null +++ b/.github/workflows/discord-notify.yml @@ -0,0 +1,27 @@ +name: Discord notify + +# 이슈, PR, CI/CD 실패를 Discord로 알림. 실제 로직은 Han-Spoon/.github의 공용 workflow을 사용. +on: + issues: + types: [opened, reopened] + # fork PR에서도 secret을 쓰기 위해 pull_request_target 사용 + pull_request_target: + types: [opened, reopened, ready_for_review, closed] + workflow_run: + workflows: ["CI", "Deploy (prod)"] # 주의: 각 workflow의 name과 일치해야 함 + types: [completed] + +permissions: + actions: read # 실패 job/step 조회 + contents: read + pull-requests: read + +jobs: + notify: + # CI/CD는 실패한 경우에만 알림 + if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'failure' + uses: Han-Spoon/.github/.github/workflows/discord-notify.yml@main + with: + team: Backend + secrets: + DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}