|
@@ -5,7 +5,10 @@ on:
|
|
|
branches-ignore:
|
|
branches-ignore:
|
|
|
- main
|
|
- main
|
|
|
paths:
|
|
paths:
|
|
|
- - 'apps/web-roo-code/**'
|
|
|
|
|
|
|
+ - "apps/web-roo-code/**"
|
|
|
|
|
+ pull_request:
|
|
|
|
|
+ paths:
|
|
|
|
|
+ - "apps/web-roo-code/**"
|
|
|
workflow_dispatch:
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
env:
|
|
env:
|
|
@@ -21,11 +24,11 @@ jobs:
|
|
|
- name: Check if VERCEL_TOKEN exists
|
|
- name: Check if VERCEL_TOKEN exists
|
|
|
id: check
|
|
id: check
|
|
|
run: |
|
|
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:
|
|
preview:
|
|
|
runs-on: ubuntu-latest
|
|
runs-on: ubuntu-latest
|
|
@@ -43,4 +46,39 @@ jobs:
|
|
|
- name: Build Project Artifacts
|
|
- name: Build Project Artifacts
|
|
|
run: npx vercel build --token=${{ secrets.VERCEL_TOKEN }}
|
|
run: npx vercel build --token=${{ secrets.VERCEL_TOKEN }}
|
|
|
- name: Deploy Project Artifacts to Vercel
|
|
- 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
|
|
|
|
|
+ });
|