Skip to content

Commit cbfac53

Browse files
committed
Update deployment action workflow to manually add succeed / fail deployment links for Vercel, pin Node dependency because GitHub uses 22.x and Vercel is on 24.x, which breaks build, and update dependencies
1 parent e01e649 commit cbfac53

4 files changed

Lines changed: 134 additions & 93 deletions

File tree

.cache/pages.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@
2222
"contact",
2323
"offline",
2424
{
25-
"privacy": ["my-data"]
25+
"privacy": [
26+
"my-data"
27+
]
2628
},
2729
{
28-
"services": ["create-custom-font-sets", "overview"]
30+
"services": [
31+
"create-custom-font-sets",
32+
"overview"
33+
]
2934
},
3035
{
3136
"tags": [
@@ -40,4 +45,4 @@
4045
"typescript"
4146
]
4247
}
43-
]
48+
]

.github/workflows/deployment.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ jobs:
5959
vercel-token: ${{ secrets.VERCEL_TOKEN }}
6060
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
6161
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
62-
github-comment: true
62+
github-comment: false
6363
env:
6464
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
6565

6666
- name: Comment preview URL on PR
67+
if: steps.vercel-preview.outcome == 'success'
6768
uses: actions/github-script@v8
6869
with:
6970
script: |
@@ -80,6 +81,25 @@ jobs:
8081
body: `✅ Tests passed! Preview deployment ready:\n\n🔗 ${previewUrl}`
8182
});
8283
84+
- name: Comment preview failure on PR
85+
if: steps.vercel-preview.outcome != 'success'
86+
uses: actions/github-script@v8
87+
with:
88+
script: |
89+
const previewUrl = '${{ steps.vercel-preview.outputs.preview-url }}';
90+
const pr = context.payload.workflow_run.pull_requests && context.payload.workflow_run.pull_requests[0];
91+
if (!pr) {
92+
core.warning('No pull request metadata available; skipping preview failure comment.');
93+
return;
94+
}
95+
const linkLine = previewUrl ? `\n\n🔗 ${previewUrl}` : '\n\n🔗 View the failed deployment in Vercel.';
96+
await github.rest.issues.createComment({
97+
issue_number: pr.number,
98+
owner: context.repo.owner,
99+
repo: context.repo.repo,
100+
body: `❌ Preview deployment failed.${linkLine}\n\nPlease review the Vercel build logs for details.`
101+
});
102+
83103
deploy-production:
84104
name: Deploy to Production (Vercel)
85105
runs-on: ubuntu-latest
@@ -111,3 +131,19 @@ jobs:
111131
run: |
112132
echo "🚀 Production deployment completed"
113133
echo "Production URL: ${{ steps.vercel-production.outputs.preview-url }}"
134+
135+
- name: Comment production deployment failure on commit
136+
if: steps.vercel-production.outcome != 'success'
137+
uses: actions/github-script@v8
138+
with:
139+
script: |
140+
const targetUrl = '${{ steps.vercel-production.outputs.preview-url }}';
141+
const body = targetUrl
142+
? `❌ Production deployment failed.\n\n🔗 ${targetUrl}\n\nPlease review the Vercel logs.`
143+
: '❌ Production deployment failed. Please review the Vercel logs.'
144+
await github.rest.repos.createCommitComment({
145+
owner: context.repo.owner,
146+
repo: context.repo.repo,
147+
commit_sha: context.payload.workflow_run.head_sha,
148+
body,
149+
});

0 commit comments

Comments
 (0)