Skip to content

Commit 065860f

Browse files
authored
Fix Vercel preview alias URL in PR comments and deployment status (#523)
1 parent 6d51502 commit 065860f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

.github/workflows/vercel-preview.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
npm install --global vercel@latest
109109
110110
DEPLOY_URL=$(vercel deploy --token "$VERCEL_TOKEN" --yes | tail -1)
111-
echo "preview-url=$DEPLOY_URL" >> $GITHUB_OUTPUT
111+
echo "deploy-url=$DEPLOY_URL" >> $GITHUB_OUTPUT
112112
113113
# Sanitize branch name for DNS: lowercase, non-alphanumeric to hyphens, collapse runs
114114
# Truncate to 46 chars so the full alias (docs-git-<branch>-authzed) stays within the 63-char DNS label limit
@@ -122,6 +122,7 @@ jobs:
122122
123123
vercel alias set "$DEPLOY_URL" "docs-git-${BRANCH}-authzed.vercel.app" \
124124
--token "$VERCEL_TOKEN"
125+
echo "alias-url=https://docs-git-${BRANCH}-authzed.vercel.app" >> $GITHUB_OUTPUT
125126
126127
- name: "Create GitHub Deployment"
127128
if: "steps.permission.outputs.result == 'true'"
@@ -130,7 +131,7 @@ jobs:
130131
with:
131132
token: "${{ secrets.GITHUB_TOKEN }}"
132133
environment: "Preview (GitHub Actions)"
133-
environment-url: "${{ steps.deploy.outputs.preview-url }}"
134+
environment-url: "${{ steps.deploy.outputs.alias-url }}"
134135
transient-environment: true
135136
auto-inactive: true
136137

@@ -141,7 +142,7 @@ jobs:
141142
token: "${{ secrets.GITHUB_TOKEN }}"
142143
deployment-id: "${{ steps.deployment.outputs.deployment_id }}"
143144
state: "success"
144-
environment-url: "${{ steps.deploy.outputs.preview-url }}"
145+
environment-url: "${{ steps.deploy.outputs.alias-url }}"
145146

146147
- name: "Update deployment status to failure"
147148
if: "steps.permission.outputs.result == 'true' && failure()"
@@ -169,7 +170,7 @@ jobs:
169170
170171
| Name | Status | Preview | Updated (UTC) |
171172
| :--- | :----- | :------ | :------------ |
172-
| **docs** | 🟢 [Ready](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | [Visit Preview](${{ steps.deploy.outputs.preview-url }}) | ${{ steps.timestamp-success.outputs.time }} |
173+
| **docs** | 🟢 [Ready](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | [Visit Preview](${{ steps.deploy.outputs.alias-url }}) | ${{ steps.timestamp-success.outputs.time }} |
173174
174175
- name: "Generate timestamp for failure"
175176
if: "steps.permission.outputs.result == 'true' && failure()"

0 commit comments

Comments
 (0)