Просмотр исходного кода

Fix roocode.com Vercel preview on PR open (#4916)

Chris Estreich 6 месяцев назад
Родитель
Сommit
53e6419fab

+ 45 - 7
.github/workflows/website-preview.yml

@@ -5,7 +5,10 @@ on:
         branches-ignore:
             - main
         paths:
-            - 'apps/web-roo-code/**'
+            - "apps/web-roo-code/**"
+    pull_request:
+        paths:
+            - "apps/web-roo-code/**"
     workflow_dispatch:
 
 env:
@@ -21,11 +24,11 @@ jobs:
             - name: Check if VERCEL_TOKEN exists
               id: check
               run: |
-                if [ -n "${{ secrets.VERCEL_TOKEN }}" ]; then
-                  echo "has-vercel-token=true" >> $GITHUB_OUTPUT
-                else
-                  echo "has-vercel-token=false" >> $GITHUB_OUTPUT
-                fi
+                  if [ -n "${{ secrets.VERCEL_TOKEN }}" ]; then
+                    echo "has-vercel-token=true" >> $GITHUB_OUTPUT
+                  else
+                    echo "has-vercel-token=false" >> $GITHUB_OUTPUT
+                  fi
 
     preview:
         runs-on: ubuntu-latest
@@ -43,4 +46,39 @@ jobs:
             - name: Build Project Artifacts
               run: npx vercel build --token=${{ secrets.VERCEL_TOKEN }}
             - name: Deploy Project Artifacts to Vercel
-              run: npx vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
+              id: deploy
+              run: |
+                  DEPLOYMENT_URL=$(npx vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
+                  echo "deployment_url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
+                  echo "Preview deployed to: $DEPLOYMENT_URL"
+
+            - name: Comment PR with preview link
+              if: github.event_name == 'pull_request'
+              uses: actions/github-script@v7
+              with:
+                  script: |
+                      const deploymentUrl = '${{ steps.deploy.outputs.deployment_url }}';
+                      const commentIdentifier = '<!-- roo-preview-comment -->';
+
+                      const { data: comments } = await github.rest.issues.listComments({
+                        owner: context.repo.owner,
+                        repo: context.repo.repo,
+                        issue_number: context.issue.number,
+                      });
+
+                      const existingComment = comments.find(comment =>
+                        comment.body.includes(commentIdentifier)
+                      );
+
+                      if (existingComment) {
+                        return;
+                      }
+
+                      const comment = commentIdentifier + '\n🚀 **Preview deployed!**\n\nYour changes have been deployed to Vercel:\n\n**Preview URL:** ' + deploymentUrl + '\n\nThis preview will be updated automatically when you push new commits to this PR.';
+
+                      await github.rest.issues.createComment({
+                        owner: context.repo.owner,
+                        repo: context.repo.repo,
+                        issue_number: context.issue.number,
+                        body: comment
+                      });

+ 1 - 1
apps/web-evals/package.json

@@ -3,7 +3,7 @@
 	"version": "0.0.0",
 	"type": "module",
 	"scripts": {
-		"lint": "next lint",
+		"lint": "next lint --max-warnings 0",
 		"check-types": "tsc -b",
 		"dev": "scripts/check-services.sh && next dev",
 		"format": "prettier --write src",

+ 1 - 1
apps/web-roo-code/package.json

@@ -3,7 +3,7 @@
 	"version": "0.0.0",
 	"type": "module",
 	"scripts": {
-		"lint": "next lint",
+		"lint": "next lint --max-warnings 0",
 		"check-types": "tsc --noEmit",
 		"dev": "next dev",
 		"build": "next build",

+ 3 - 3
apps/web-roo-code/src/app/privacy/page.tsx

@@ -17,8 +17,8 @@ export default function Privacy() {
 					<p className="text-muted-foreground">Last Updated: June 19, 2025</p>
 
 					<p className="lead">
-						This Privacy Policy explains how Roo Code, Inc. ("Roo Code," "we," "our," or "us") collects,
-						uses, and shares information when you:
+						This Privacy Policy explains how Roo Code, Inc. (&quot;Roo Code,&quot; &quot;we,&quot;
+						&quot;our,&quot; or &quot;us&quot;) collects, uses, and shares information when you:
 					</p>
 					<ul className="lead">
 						<li>
@@ -149,7 +149,7 @@ export default function Privacy() {
 						</li>
 					</ul>
 
-					<h2 className="mt-12 text-2xl font-bold">3. Where Your Data Goes (And Doesn't)</h2>
+					<h2 className="mt-12 text-2xl font-bold">3. Where Your Data Goes (And Doesn&apos;t)</h2>
 
 					<div className="overflow-x-auto">
 						<table className="min-w-full border-collapse border border-border">