1. 슬랙 앱 생성 및 설정
링크 접속: https://api.slack.com/apps
Slack API: Applications | Slack
Your Apps Don't see an app you're looking for? Sign in to another workspace.
api.slack.com
2. Create New App
- From scratch 선택
- App name : Front Release Notification App
- 슬랙 워크스페이스 선택
3. Incoming Webhooks 탭 이동
- On 활성화 처리
4. 화면 하단의 Add New Webhooks to Workspace
- 게시할 채널 선택 : 알림 받을 채널을 선택
- 생성된 Webhook Url 복사
5. Github Repository 설정 - Secrets and Variables - Actions 로 접속
- New repository secert 클릭
- SLACK_WEBHOOK_URL
- 아까 복사한 웹훅 url 기입
6. github action yml 파일에 액션 추가
- 배포 완료시 슬랙으로 알림을 보내라는 action 을 추가
- name: Notify Slack on Success
if: success()
id: slack-success
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"channel": "슬랙 채널 ID",
"attachments": [
{
"color": "#36a64f",
"title": "✅ GitHub Action 성공",
"title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}",
"fields": [
{
"title": "Repository",
"value": "${{ github.repository }}",
"short": true
},
{
"title": "Tag",
"value": "${{ github.ref_name }}",
"short": true
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Notify Slack on Failure
if: failure() # 이 step은 job이 실패한 경우에만 실행됩니다.
id: slack-failure
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"channel": "슬랙 채널 ID",
"attachments": [
{
"color": "#ff0000",
"title": "‼️ GitHub Action 실패",
"title_link": "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}",
"fields": [
{
"title": "Repository",
"value": "${{ github.repository }}",
"short": true
},
{
"title": "Tag",
"value": "${{ github.ref_name }}",
"short": true
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
'programming' 카테고리의 다른 글
[1/3] Next.js + AWS ECS 컨테이너 배포하기 : CodePipeline 활용한 CI/CD 자동화와 Docker 빌드 최적화 사례 분석 (0) | 2025.04.11 |
---|---|
PR에 이미 병합된 커밋이 다시 나타남 (Bitbucket pull request 기존 커밋 포함) (0) | 2025.04.10 |
Sass 컴파일러 vscode 에서 사용하기 (0) | 2023.05.04 |
OOP(Object Oriented Programing) 객체지향 프로그래밍 (0) | 2022.10.04 |
[DB] 테이블간의 관계성 만들기 (0) | 2022.05.20 |