Skip to content

Fix pull request preview deployment workflow #1179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

riderx
Copy link
Contributor

@riderx riderx commented Aug 3, 2025

Summary

This PR overhauls the preview deployment workflow to accurately mirror the production deployment process. The goal is to provide a reliable, production-like testing environment for every pull request. This includes deploying Supabase functions, the frontend, and all Cloudflare Workers (API, Files, Plugin) with their respective production configurations and bindings, but using the PR's code. Upon successful deployment, direct links to all preview environments are now posted as a comment on the pull request.

Test plan

  1. Open a new pull request to this repository.
  2. Observe the GitHub Actions workflow run for preview_deploy.yml.
  3. Verify that all jobs (supabase_deploy, deploy_webapp, deploy_api, deploy_files, deploy_plugin, comment_pr) complete successfully.
  4. Check the PR comments for a new comment containing links to the deployed preview environments (frontend, API, files, plugin).
  5. Click on each link to ensure the preview environments are accessible and functional.
  6. Close the pull request and verify that the preview_cleanup workflow runs and removes the deployed preview resources.

Screenshots

N/A

Checklist

  • My code follows the code style of this project and passes bun run lint-backend && bun run lint.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • My change has adequate E2E test coverage.
  • I have tested my code manually, and I have provided steps how to reproduce my tests

Open in Cursor Open in Web

Learn more about Cursor Agents

Copy link

coderabbitai bot commented Aug 3, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cursor/fix-pull-request-preview-deployment-workflow-e35b

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.


- name: Set Supabase credentials
run: |
echo "SUPABASE_DB_PASSWORD=${{ secrets[format('SUPABASE_DB_PASS_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV

Check warning

Code scanning / CodeQL

Excessive Secrets Exposure Medium

All organization and repository secrets are passed to the workflow runner in
secrets[format('SUPABASE_DB_PASS_{0}', env.SUPA_ENV)]

Copilot Autofix

AI 20 days ago

To fix the problem, we need to avoid dynamic secret access and instead reference secrets statically. Since the workflow currently uses env.SUPA_ENV (set to "PROD") to determine which secret to use, we can directly reference the production secrets. Specifically, replace:

echo "SUPABASE_DB_PASSWORD=${{ secrets[format('SUPABASE_DB_PASS_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV
echo "SUPABASE_PROJECT_ID=${{ secrets[format('SUPABASE_PROJECT_ID_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV

with:

echo "SUPABASE_DB_PASSWORD=${{ secrets.SUPABASE_DB_PASS_PROD }}" >> $GITHUB_ENV
echo "SUPABASE_PROJECT_ID=${{ secrets.SUPABASE_PROJECT_ID_PROD }}" >> $GITHUB_ENV

This change should be made in .github/workflows/preview_deploy.yml, lines 33 and 34. No new imports or methods are needed, just a direct edit to the workflow YAML.


Suggested changeset 1
.github/workflows/preview_deploy.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/preview_deploy.yml b/.github/workflows/preview_deploy.yml
--- a/.github/workflows/preview_deploy.yml
+++ b/.github/workflows/preview_deploy.yml
@@ -32,4 +32,4 @@
         run: |
-          echo "SUPABASE_DB_PASSWORD=${{ secrets[format('SUPABASE_DB_PASS_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV
-          echo "SUPABASE_PROJECT_ID=${{ secrets[format('SUPABASE_PROJECT_ID_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV
+          echo "SUPABASE_DB_PASSWORD=${{ secrets.SUPABASE_DB_PASS_PROD }}" >> $GITHUB_ENV
+          echo "SUPABASE_PROJECT_ID=${{ secrets.SUPABASE_PROJECT_ID_PROD }}" >> $GITHUB_ENV
       - name: Install dependencies
EOF
@@ -32,4 +32,4 @@
run: |
echo "SUPABASE_DB_PASSWORD=${{ secrets[format('SUPABASE_DB_PASS_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV
echo "SUPABASE_PROJECT_ID=${{ secrets[format('SUPABASE_PROJECT_ID_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV
echo "SUPABASE_DB_PASSWORD=${{ secrets.SUPABASE_DB_PASS_PROD }}" >> $GITHUB_ENV
echo "SUPABASE_PROJECT_ID=${{ secrets.SUPABASE_PROJECT_ID_PROD }}" >> $GITHUB_ENV
- name: Install dependencies
Copilot is powered by AI and may make mistakes. Always verify output.
- name: Set Supabase credentials
run: |
echo "SUPABASE_DB_PASSWORD=${{ secrets[format('SUPABASE_DB_PASS_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV
echo "SUPABASE_PROJECT_ID=${{ secrets[format('SUPABASE_PROJECT_ID_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV

Check warning

Code scanning / CodeQL

Excessive Secrets Exposure Medium

All organization and repository secrets are passed to the workflow runner in
secrets[format('SUPABASE_PROJECT_ID_{0}', env.SUPA_ENV)]

Copilot Autofix

AI 20 days ago

To fix the problem, we need to avoid dynamic secret access and instead reference each required secret explicitly. Since SUPA_ENV is set to PROD in the workflow, only the production secrets are ever used. Therefore, we can replace the dynamic secret access with direct references to secrets.SUPABASE_DB_PASS_PROD and secrets.SUPABASE_PROJECT_ID_PROD. This change should be made in the step "Set Supabase credentials" (lines 31–34). No other changes are needed, as the rest of the workflow already uses explicit secret references.


Suggested changeset 1
.github/workflows/preview_deploy.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/preview_deploy.yml b/.github/workflows/preview_deploy.yml
--- a/.github/workflows/preview_deploy.yml
+++ b/.github/workflows/preview_deploy.yml
@@ -32,4 +32,4 @@
         run: |
-          echo "SUPABASE_DB_PASSWORD=${{ secrets[format('SUPABASE_DB_PASS_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV
-          echo "SUPABASE_PROJECT_ID=${{ secrets[format('SUPABASE_PROJECT_ID_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV
+          echo "SUPABASE_DB_PASSWORD=${{ secrets.SUPABASE_DB_PASS_PROD }}" >> $GITHUB_ENV
+          echo "SUPABASE_PROJECT_ID=${{ secrets.SUPABASE_PROJECT_ID_PROD }}" >> $GITHUB_ENV
       - name: Install dependencies
EOF
@@ -32,4 +32,4 @@
run: |
echo "SUPABASE_DB_PASSWORD=${{ secrets[format('SUPABASE_DB_PASS_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV
echo "SUPABASE_PROJECT_ID=${{ secrets[format('SUPABASE_PROJECT_ID_{0}', env.SUPA_ENV)] }}" >> $GITHUB_ENV
echo "SUPABASE_DB_PASSWORD=${{ secrets.SUPABASE_DB_PASS_PROD }}" >> $GITHUB_ENV
echo "SUPABASE_PROJECT_ID=${{ secrets.SUPABASE_PROJECT_ID_PROD }}" >> $GITHUB_ENV
- name: Install dependencies
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +55 to +90
needs: supabase_deploy
runs-on: ubuntu-latest
name: Deploy Frontend Preview
outputs:
preview_url: ${{ steps.deploy_frontend.outputs.url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Set preview environment variables
run: |
echo "PREVIEW_NAME=capgo-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV
echo "PREVIEW_DOMAIN=capgo-preview-${{ env.PR_NUMBER }}.pages.dev" >> $GITHUB_ENV
echo "API_PREVIEW_NAME=capgo-api-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV
echo "FILES_PREVIEW_NAME=capgo-files-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV
echo "PLUGIN_PREVIEW_NAME=capgo-plugin-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV

- name: Build frontend (production build)
run: bun mobile
env:
VITE_VAPID_KEY: ${{ secrets.VITE_VAPID_KEY }}
VITE_FIREBASE_CONFIG: ${{ secrets.VITE_FIREBASE_CONFIG }}

- name: Deploy frontend to Cloudflare Pages
id: deploy_frontend
run: |
# Deploy to a preview project using production build
bunx wrangler@latest pages deploy dist \
--project-name ${{ env.PREVIEW_NAME }} \
--branch preview-${{ env.PR_NUMBER }} \
--commit-dirty=true

# Set the preview URL as output
echo "url=https://${{ env.PREVIEW_DOMAIN }}" >> $GITHUB_OUTPUT
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

- name: Deploy API Worker (production config)
deploy_api:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 20 days ago

To fix the problem, add a permissions block to the workflow file .github/workflows/preview_deploy.yml. This block should be placed at the top level (after the name: and before concurrency: or on:) to apply to all jobs unless overridden. The minimal starting point is contents: read, which allows jobs to check out code but not modify repository contents. If any job requires additional permissions (e.g., to create issues or pull requests), those can be added as needed, but for the jobs shown, contents: read is sufficient.

Suggested changeset 1
.github/workflows/preview_deploy.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/preview_deploy.yml b/.github/workflows/preview_deploy.yml
--- a/.github/workflows/preview_deploy.yml
+++ b/.github/workflows/preview_deploy.yml
@@ -1,2 +1,4 @@
 name: Deploy Preview Environment
+permissions:
+  contents: read
 
EOF
@@ -1,2 +1,4 @@
name: Deploy Preview Environment
permissions:
contents: read

Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +91 to +124
needs: supabase_deploy
runs-on: ubuntu-latest
name: Deploy API Worker Preview
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Set preview environment variables
run: |
# Create preview config from production config
jq '.name = "${{ env.API_PREVIEW_NAME }}" | .workers_dev = true | del(.route) | del(.routes)' \
cloudflare_workers/api/wrangler.json > /tmp/wrangler-api-preview.json

bunx wrangler deploy --config /tmp/wrangler-api-preview.json --minify
echo "API_PREVIEW_NAME=capgo-api-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV
- name: Create preview API worker config
run: |
# Create a temporary wrangler config for preview with production bindings
cat cloudflare_workers/api/wrangler.json | \
jq --arg name "${{ env.API_PREVIEW_NAME }}" \
'.name = $name | .workers_dev = true | del(.route) | del(.routes)' \
> /tmp/wrangler-api-preview.json
- name: Deploy API Worker (with production config)
run: bunx wrangler deploy --config /tmp/wrangler-api-preview.json --minify
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Deploy API Worker environment variables
run: node scripts/deploy_cf_backend_env.mjs internal/cloudflare/.env.prod ${{ env.API_PREVIEW_NAME }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

- name: Deploy Files Worker (production config)
deploy_files:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 20 days ago

To fix the problem, add a permissions block to the root of the workflow file (.github/workflows/preview_deploy.yml). This will set the default permissions for all jobs in the workflow, limiting the GITHUB_TOKEN to only the specified scopes. The recommended minimal starting point is contents: read, which allows jobs to read repository contents but not write to them. If any job requires additional permissions (e.g., to comment on pull requests), those can be added at the job level. The change should be made at the top of the workflow file, after the name: declaration and before the concurrency: or on: blocks.

Suggested changeset 1
.github/workflows/preview_deploy.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/preview_deploy.yml b/.github/workflows/preview_deploy.yml
--- a/.github/workflows/preview_deploy.yml
+++ b/.github/workflows/preview_deploy.yml
@@ -1,2 +1,4 @@
 name: Deploy Preview Environment
+permissions:
+  contents: read
 
EOF
@@ -1,2 +1,4 @@
name: Deploy Preview Environment
permissions:
contents: read

Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +125 to +158
needs: supabase_deploy
runs-on: ubuntu-latest
name: Deploy Files Worker Preview
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Set preview environment variables
run: |
echo "FILES_PREVIEW_NAME=capgo-files-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV
- name: Create preview Files worker config
run: |
# Create preview config from production config
jq '.name = "${{ env.FILES_PREVIEW_NAME }}" | .workers_dev = true | del(.route) | del(.routes)' \
cloudflare_workers/files/wrangler.json > /tmp/wrangler-files-preview.json

bunx wrangler deploy --config /tmp/wrangler-files-preview.json --minify
# Create a temporary wrangler config for preview with production bindings
cat cloudflare_workers/files/wrangler.json | \
jq --arg name "${{ env.FILES_PREVIEW_NAME }}" \
'.name = $name | .workers_dev = true | del(.routes)' \
> /tmp/wrangler-files-preview.json
- name: Deploy Files Worker (with production config)
run: bunx wrangler deploy --config /tmp/wrangler-files-preview.json --minify
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Deploy Files Worker environment variables
run: node scripts/deploy_cf_backend_env.mjs internal/cloudflare/.env.prod ${{ env.FILES_PREVIEW_NAME }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

- name: Deploy Plugin Worker (production config)
deploy_plugin:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 20 days ago

To fix the problem, add a permissions block at the top level of the workflow file, immediately after the name: field and before any jobs or steps. This block should specify the minimal permissions required for the workflow to function. As a safe default, set contents: read, which allows the workflow to read repository contents but not write to them. If any job requires additional permissions (such as pull-requests: write), those can be added at the job level, but based on the provided code, contents: read is sufficient. The change should be made at the top of .github/workflows/preview_deploy.yml, after the name: field and before concurrency:.


Suggested changeset 1
.github/workflows/preview_deploy.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/preview_deploy.yml b/.github/workflows/preview_deploy.yml
--- a/.github/workflows/preview_deploy.yml
+++ b/.github/workflows/preview_deploy.yml
@@ -1,2 +1,4 @@
 name: Deploy Preview Environment
+permissions:
+  contents: read
 
EOF
@@ -1,2 +1,4 @@
name: Deploy Preview Environment
permissions:
contents: read

Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +159 to +192
needs: supabase_deploy
runs-on: ubuntu-latest
name: Deploy Plugin Worker Preview
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Set preview environment variables
run: |
echo "PLUGIN_PREVIEW_NAME=capgo-plugin-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV
- name: Create preview Plugin worker config
run: |
# Create preview config from production config
jq '.name = "${{ env.PLUGIN_PREVIEW_NAME }}" | .workers_dev = true | del(.route) | del(.routes)' \
cloudflare_workers/plugin/wrangler.json > /tmp/wrangler-plugin-preview.json

bunx wrangler deploy --config /tmp/wrangler-plugin-preview.json --minify
# Create a temporary wrangler config for preview with production bindings
cat cloudflare_workers/plugin/wrangler.json | \
jq --arg name "${{ env.PLUGIN_PREVIEW_NAME }}" \
'.name = $name | .workers_dev = true | del(.routes)' \
> /tmp/wrangler-plugin-preview.json
- name: Deploy Plugin Worker (with production config)
run: bunx wrangler deploy --config /tmp/wrangler-plugin-preview.json --minify
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Deploy Plugin Worker environment variables
run: node scripts/deploy_cf_backend_env.mjs internal/cloudflare/.env.prod ${{ env.PLUGIN_PREVIEW_NAME }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

comment_pr:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 20 days ago

To fix the problem, add a permissions block at the top level of the workflow file, specifying the minimal permissions required for all jobs. If some jobs require additional permissions, you can override the permissions block at the job level. For this workflow:

  • Most jobs likely only need contents: read (to check out code).
  • The comment_pr job needs pull-requests: write to comment on PRs.
  • If any other jobs require more permissions, they can be specified as needed.

The best fix is to add the following at the top of the workflow (after name: and before concurrency:):

permissions:
  contents: read

Then, for the comment_pr job, add a permissions block to allow writing to pull requests:

permissions:
  contents: read
  pull-requests: write

No new imports or definitions are needed; only YAML changes.


Suggested changeset 1
.github/workflows/preview_deploy.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/preview_deploy.yml b/.github/workflows/preview_deploy.yml
--- a/.github/workflows/preview_deploy.yml
+++ b/.github/workflows/preview_deploy.yml
@@ -2,2 +2,5 @@
 
+permissions:
+  contents: read
+
 concurrency:
@@ -195,2 +198,5 @@
     name: Comment PR with preview URLs
+    permissions:
+      contents: read
+      pull-requests: write
     steps:
EOF
@@ -2,2 +2,5 @@

permissions:
contents: read

concurrency:
@@ -195,2 +198,5 @@
name: Comment PR with preview URLs
permissions:
contents: read
pull-requests: write
steps:
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link

sonarqubecloud bot commented Aug 3, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants