Skip to content

Commit 55c8672

Browse files
Refactor Slack notification step in CI workflow for clarity and improved messaging
1 parent 3102133 commit 55c8672

File tree

1 file changed

+49
-15
lines changed

1 file changed

+49
-15
lines changed

.github/workflows/main.yml

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,52 @@ jobs:
7474
BASE_URL: ${{ env.DEPLOYMENT_URL }}
7575

7676

77-
# notify:
78-
# name: Send Slack Notification
79-
# runs-on: ubuntu-latest
80-
# needs: [deploy, e2e]
81-
# if: failure()
82-
# steps:
83-
# - name: Notify Slack
84-
# uses: slackapi/[email protected]
85-
# with:
86-
# payload: |
87-
# {
88-
# "text": "Workflow failed for branch: ${{ github.ref_name }}. Please check the logs for details."
89-
# }
90-
# env:
91-
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
77+
#notify:
78+
# name: Notify Team on Failure
79+
# runs-on: ubuntu-latest
80+
# needs: e2e
81+
# if: failure()
82+
# steps:
83+
# - name: Send Slack Notification
84+
# uses: slackapi/[email protected]
85+
# with:
86+
# payload: |
87+
# {
88+
# "text": "🚨 Production deployment failed! Check logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
89+
# }
90+
# env:
91+
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
92+
93+
# rollback:
94+
# name: Rollback on Failure
95+
# runs-on: ubuntu-latest
96+
# needs: e2e
97+
# if: failure()
98+
99+
# steps:
100+
# - name: Checkout Code
101+
# uses: actions/checkout@v3
102+
103+
# - name: Install Vercel CLI
104+
# run: npm install --global vercel@latest
105+
106+
# - name: Authenticate Vercel CLI
107+
# run: vercel login --token=${{ secrets.VERCEL_TOKEN_MY_PROJECT }}
108+
109+
# - name: Get Last Successful Production Deployment
110+
# id: get_last_deployment
111+
# run: |
112+
# echo "Fetching last successful production deployment..."
113+
# LAST_DEPLOYMENT=$(vercel list --prod --token=${{ secrets.VERCEL_TOKEN_MY_PROJECT }} | grep -Eo 'https://[a-zA-Z0-9.-]+\.vercel\.app' | tail -1)
114+
# if [[ -z "$LAST_DEPLOYMENT" ]]; then
115+
# echo "❌ No previous successful deployment found! Rollback failed."
116+
# exit 1
117+
# fi
118+
# echo "✅ Last successful deployment found: $LAST_DEPLOYMENT"
119+
# echo "LAST_DEPLOYMENT=$LAST_DEPLOYMENT" >> $GITHUB_ENV
120+
121+
# - name: Rollback to Last Working Deployment
122+
# run: |
123+
# echo "Rolling back to: $LAST_DEPLOYMENT"
124+
# vercel promote $LAST_DEPLOYMENT --token=${{ secrets.VERCEL_TOKEN_MY_PROJECT }}
125+
# echo "✅ Rollback successful! Restored $LAST_DEPLOYMENT"

0 commit comments

Comments
 (0)