Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

chore(ci): remove unused Vercel preview workflow (#3161)

Cindy Zhange6523e1c32aa
diff --git a/.github/workflows/vercel-preview.yml b/.github/workflows/vercel-preview.yml
deleted file mode 100644
index 26dbbe51c5..0000000000
--- a/.github/workflows/vercel-preview.yml
+++ /dev/null
@@ -1,179 +0,0 @@
-# Copyright (c) Meta Platforms, Inc. and affiliates.
-
-# Deploy PR previews to Vercel.
-# Runs on every PR — triggers a Vercel preview deployment and posts a
-# comment with the deployment URL and status.
-#
-# Required secrets:
-# VERCEL_TOKEN — Vercel API token (must have team scope)
-# VERCEL_ORG_ID — Vercel team/org ID
-# VERCEL_PROJECT_ID — Vercel project ID
-#
-# To disable authentication on previews, go to Vercel project settings:
-# Settings → General → "Vercel Authentication" → toggle OFF
-
-name: Vercel Preview
-
-on:
- pull_request:
- branches: ["main"]
-
-permissions: {}
-
-concurrency:
- group: "vercel-preview-${{ github.event.pull_request.number }}"
- cancel-in-progress: true
-
-jobs:
- deploy-preview:
- # Fork PRs don't receive repository secrets, so VERCEL_TOKEN/ORG/PROJECT are
- # empty and `vercel pull` fails. Their GITHUB_TOKEN is also read-only, so the
- # PR comment can't post either. Skip on forks (neutral, not failing); the
- # Vercel GitHub App still posts its own "authorize this preview" comment, and
- # a maintainer can authorize the deploy from the Vercel dashboard.
- if: github.event.pull_request.head.repo.full_name == github.repository
- runs-on: ubuntu-latest
- permissions:
- contents: read
- pull-requests: write
- env:
- VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
- VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- steps:
- - name: Checkout
- uses: actions/checkout@v6
-
- - name: Setup pnpm
- uses: pnpm/action-setup@v6
-
- - name: Setup Node.js
- uses: actions/setup-node@v6
- with:
- node-version: 24
- cache: 'pnpm'
-
- - name: Install Vercel CLI
- run: npm install -g vercel@latest
-
- - name: Pull Vercel environment
- run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
-
- - name: Build with Vercel
- id: build
- run: |
- if vercel build --token=${{ secrets.VERCEL_TOKEN }} 2>&1 | tee /tmp/vercel-build.log; then
- echo "status=success" >> $GITHUB_OUTPUT
- else
- echo "status=failure" >> $GITHUB_OUTPUT
- # Capture last 30 lines of build output for the error summary
- echo "error_log<<ERREOF" >> $GITHUB_OUTPUT
- tail -30 /tmp/vercel-build.log >> $GITHUB_OUTPUT
- echo "ERREOF" >> $GITHUB_OUTPUT
- fi
-
- - name: Deploy to Vercel
- id: deploy
- if: steps.build.outputs.status == 'success'
- run: |
- DEPLOY_OUTPUT=$(vercel deploy --prebuilt \
- --token=${{ secrets.VERCEL_TOKEN }} \
- --meta githubPrNumber=${{ github.event.pull_request.number }} \
- --meta githubCommitSha=${{ github.event.pull_request.head.sha }} \
- --meta githubRepo=${{ github.repository }} 2>&1 | tee /tmp/vercel-deploy.log)
-
- DEPLOY_URL=$(echo "$DEPLOY_OUTPUT" | grep -oE 'https://[^ ]+\.vercel\.app' | tail -1)
- INSPECT_URL=$(echo "$DEPLOY_OUTPUT" | grep -oE 'https://vercel\.com/[^ ]+' | head -1)
-
- echo "url=${DEPLOY_URL}" >> $GITHUB_OUTPUT
- echo "inspect_url=${INSPECT_URL}" >> $GITHUB_OUTPUT
- echo "Deployed to: ${DEPLOY_URL}"
- echo "Inspect at: ${INSPECT_URL}"
-
- - name: Comment on PR
- if: always()
- uses: actions/github-script@v9
- env:
- DEPLOY_URL: ${{ steps.deploy.outputs.url }}
- INSPECT_URL: ${{ steps.deploy.outputs.inspect_url }}
- BUILD_STATUS: ${{ steps.build.outputs.status }}
- BUILD_ERROR: ${{ steps.build.outputs.error_log }}
- with:
- script: |
- const deployUrl = process.env.DEPLOY_URL || '';
- const inspectUrl = process.env.INSPECT_URL || '';
- const buildStatus = process.env.BUILD_STATUS || 'failure';
- const buildError = process.env.BUILD_ERROR || '';
- const sha = '${{ github.event.pull_request.head.sha }}'.slice(0, 7);
- const prNumber = ${{ github.event.pull_request.number }};
- const runUrl = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
-
- let body;
- if (deployUrl && deployUrl.startsWith('https://')) {
- const rows = [
- `| **Status** | ✅ Deployed |`,
- `| **Preview** | [Open Preview](${deployUrl}) |`,
- `| **Commit** | \`${sha}\` |`,
- ];
- if (inspectUrl) {
- rows.push(`| **Inspect** | [Vercel Dashboard](${inspectUrl}) |`);
- }
- rows.push(`| **Workflow** | [View Logs](${runUrl}) |`);
-
- body = [
- '## 🚀 Vercel Preview Deployment',
- '',
- '| | |',
- '|---|---|',
- ...rows,
- '',
- '> No authentication required — anyone with the link can view the preview.',
- ].join('\n');
- } else {
- const rows = [
- `| **Status** | ❌ Failed |`,
- `| **Commit** | \`${sha}\` |`,
- `| **Workflow** | [View Logs](${runUrl}) |`,
- ];
- if (inspectUrl) {
- rows.push(`| **Vercel** | [View Build Logs](${inspectUrl}) |`);
- }
-
- body = [
- '## 🚀 Vercel Preview Deployment',
- '',
- '| | |',
- '|---|---|',
- ...rows,
- ].join('\n');
-
- if (buildError) {
- body += '\n\n<details><summary>Build Error</summary>\n\n```\n' + buildError + '\n```\n\n</details>';
- }
- }
-
- const { data: comments } = await github.rest.issues.listComments({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: prNumber,
- });
-
- const botComment = comments.find(comment =>
- comment.user.type === 'Bot' &&
- comment.body.includes('Vercel Preview Deployment')
- );
-
- if (botComment) {
- await github.rest.issues.updateComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- comment_id: botComment.id,
- body: body,
- });
- } else {
- await github.rest.issues.createComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: prNumber,
- body: body,
- });
- }