Skip to content

Conversation

@riderx
Copy link
Member

@riderx riderx commented Jan 22, 2026

Summary

  • Adds new blog article explaining how to set up PR previews with Capgo
  • Covers GitHub Actions workflow for per-PR channels
  • Explains how testers switch channels (shake menu or setChannel API)
  • Includes cleanup workflow and best practices

Test plan

  • Verify markdown renders correctly
  • Check all internal links work
  • Ensure head_image reference is valid

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • New blog article published covering PR previews, including setup instructions, channel switching methods, best practices, and comparisons to traditional testing approaches.

✏️ Tip: You can customize this high-level summary in your review settings.

Covers how to set up PR previews with Capgo using GitHub Actions,
enabling QA, PMs, and developers to test features without TestFlight.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 22, 2026 05:41
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

Warning

Rate limit exceeded

@riderx has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 49 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

A new blog post article is introduced documenting PR previews functionality, covering setup procedures, implementation methods via GitHub Actions, channel switching techniques, and best practices for automated testing workflows.

Changes

Cohort / File(s) Summary
Blog Post Addition
src/content/blog/en/turn-every-pr-into-installable-preview.md
New comprehensive blog post (254 lines) with YAML front matter and article body covering PR preview workflows, GitHub Actions setup, channel switching mechanisms, cleanup procedures, and usage guidelines. Includes code examples and instructional sections.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~8 minutes

Poem

🐰 A tale of previews, swift and bright,

PR channels dancing left and right,

TestFlight's burden now takes flight,

Our docs hop forth with pure delight! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a blog post about PR previews with Capgo. It matches the primary alteration in the changeset (a new blog post file).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@src/content/blog/en/turn-every-pr-into-installable-preview.md`:
- Line 78: The workflow's channel creation command (bunx `@capgo/cli` channel add
pr-${{ github.event.pull_request.number }} --self-assign) can fail (e.g.,
channel already exists) but the example always proceeds to post the comment;
update the "channel add" step to detect success/failure and expose a step output
(or use a non-failing flag if the CLI supports it) and then make the
comment/post step conditional (only run when the create-channel step succeeded).
Specifically, modify the step that runs "bunx `@capgo/cli` channel add pr-${{
github.event.pull_request.number }} --self-assign" to return a clear success
indicator (exit code check, set-output or step outcome) and reference that
indicator in the comment step's if: condition so comments are only posted when
channel creation actually succeeded.
- Line 49: The internal link "/solutions/pr-preview/" is invalid and should be
fixed; locate the markdown in
src/content/blog/en/turn-every-pr-into-installable-preview.md that contains the
"/solutions/pr-preview/" URL and either update it to the correct existing path
(e.g., replace with a valid docs or blog URL) or remove the anchor entirely if
the page doesn't exist, ensuring the other links remain unchanged.
- Line 10: The frontmatter key head_image in
src/content/blog/en/turn-every-pr-into-installable-preview.md references the
image file capgo_pr_preview.webp which is missing; add the image file named
capgo_pr_preview.webp to the project's public/static assets so it is served at
/capgo_pr_preview.webp, commit the file, and if you choose a different name or
location update the head_image value to match.
- Around line 55-99: The workflow currently triggers on both pull_request opened
and synchronize and the "Comment on PR" step uses
github.rest.issues.createComment, causing duplicate comments on each push;
either restrict the trigger to only opened (change on.pull_request.types to
[opened]) or modify the "Comment on PR" step to find/update the existing bot
comment instead of always calling github.rest.issues.createComment (use
github.rest.issues.listComments + github.rest.issues.updateComment or use an
action like peter-evans/create-or-update-comment) — update the YAML's
on.pull_request.types and/or replace the createComment call in the "Comment on
PR" step so it searches for an existing comment by the bot and updates it when
present.

author_url: 'https://x.com/martindonadieu'
created_at: 2025-01-22T00:00:00.000Z
updated_at: 2025-01-22T00:00:00.000Z
head_image: /capgo_pr_preview.webp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if the head_image file exists
fd -t f "capgo_pr_preview.webp"

Repository: Cap-go/website

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Find all webp files
echo "=== All webp files in repository ==="
fd -t f -e "webp"

# Check common static/public directories
echo ""
echo "=== Checking common static asset directories ==="
for dir in public static assets images img src/assets src/public; do
  if [ -d "$dir" ]; then
    echo "Found directory: $dir"
    ls -la "$dir" 2>/dev/null | head -20
  fi
done

Repository: Cap-go/website

Length of output: 22122


🏁 Script executed:

#!/bin/bash
# Check the blog post frontmatter
head -20 src/content/blog/en/turn-every-pr-into-installable-preview.md

Repository: Cap-go/website

Length of output: 1068


Add the missing head_image file /capgo_pr_preview.webp.

The blog post frontmatter references /capgo_pr_preview.webp on line 10, but this image file does not exist in the repository. Add the image to the public/ directory to ensure proper rendering of the blog post.

🤖 Prompt for AI Agents
In `@src/content/blog/en/turn-every-pr-into-installable-preview.md` at line 10,
The frontmatter key head_image in
src/content/blog/en/turn-every-pr-into-installable-preview.md references the
image file capgo_pr_preview.webp which is missing; add the image file named
capgo_pr_preview.webp to the project's public/static assets so it is served at
/capgo_pr_preview.webp, commit the file, and if you choose a different name or
location update the head_image value to match.


## Setting Up PR Previews

Before you can implement PR previews, your project needs to be configured with Capgo Live Updates. Follow the [Capgo quickstart guide](/docs/getting-started/quickstart/) if you haven't already.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if internal link targets exist in the content directory structure

echo "=== Checking for quickstart documentation ==="
find src/content -type f -name "*quickstart*" 2>/dev/null

echo -e "\n=== Checking for 'how-capgo-channel-switching-works' blog post ==="
find src/content -type f -name "*channel-switching*" 2>/dev/null

echo -e "\n=== Checking for 'channels' documentation ==="
find src/content/docs -type f -name "*channels*" 2>/dev/null

echo -e "\n=== Checking for 'commands' documentation ==="
find src/content/docs -type f -name "*commands*" 2>/dev/null

echo -e "\n=== Checking for 'pr-preview' solution page ==="
find src/content -type f -name "*pr-preview*" 2>/dev/null

echo -e "\n=== Directory structure check ==="
echo "docs/ structure:"
ls -la src/content/docs/en/ 2>/dev/null | head -20

echo -e "\nblog/ structure:"
ls -la src/content/blog/en/ 2>/dev/null | head -20

echo -e "\nsolutions/ structure:"
ls -la src/content/solutions/ 2>/dev/null || echo "solutions directory not found"

Repository: Cap-go/website

Length of output: 4998


Fix invalid internal link at line 246.

The link /solutions/pr-preview/ (line 246) does not exist. The solutions directory is not present in the codebase. Verify the correct path or remove this link if the page does not exist. The other links (/docs/getting-started/quickstart/, /blog/how-capgo-channel-switching-works/, /docs/live-updates/channels/, /docs/cli/commands/) are valid.

🤖 Prompt for AI Agents
In `@src/content/blog/en/turn-every-pr-into-installable-preview.md` at line 49,
The internal link "/solutions/pr-preview/" is invalid and should be fixed;
locate the markdown in
src/content/blog/en/turn-every-pr-into-installable-preview.md that contains the
"/solutions/pr-preview/" URL and either update it to the correct existing path
(e.g., replace with a valid docs or blog URL) or remove the anchor entirely if
the page doesn't exist, ensuring the other links remain unchanged.

Comment on lines +55 to +99
```yaml
name: PR Preview
on:
pull_request:
types: [opened, synchronize]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v1

- name: Install Dependencies
run: bun install

- name: Build
run: bun run build

# Create a channel named after your PR
- name: Create PR Channel
run: bunx @capgo/cli channel add pr-${{ github.event.pull_request.number }} --self-assign
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}

# Upload the build to that channel
- name: Upload to Capgo
run: bunx @capgo/cli bundle upload --channel pr-${{ github.event.pull_request.number }}
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}

# Post a comment with testing instructions
- name: Comment on PR
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.pull_request.number }},
body: '📱 **Test this PR on device:**\n\nOpen your app and switch to channel: `pr-${{ github.event.pull_request.number }}`\n\nUse the shake menu or call `setChannel()` from your app.'
})
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Workflow may post duplicate comments on each commit.

The workflow triggers on both opened and synchronize events (line 58-59). Every time new commits are pushed to the PR, the comment step (lines 89-98) will post another comment with the same testing instructions, potentially cluttering the PR.

💡 Suggested improvements

Option 1: Only comment on PR open

 on:
   pull_request:
-    types: [opened, synchronize]
+    types: [opened, synchronize]

 jobs:
   deploy:
     runs-on: ubuntu-latest
     steps:
       # ... other steps ...

       # Post a comment with testing instructions
       - name: Comment on PR
+        if: github.event.action == 'opened'
         uses: actions/github-script@v7

Option 2: Update the existing comment instead of creating a new one

You can find and update the previous bot comment instead of creating duplicates. This requires storing the comment ID or searching for it.

🤖 Prompt for AI Agents
In `@src/content/blog/en/turn-every-pr-into-installable-preview.md` around lines
55 - 99, The workflow currently triggers on both pull_request opened and
synchronize and the "Comment on PR" step uses github.rest.issues.createComment,
causing duplicate comments on each push; either restrict the trigger to only
opened (change on.pull_request.types to [opened]) or modify the "Comment on PR"
step to find/update the existing bot comment instead of always calling
github.rest.issues.createComment (use github.rest.issues.listComments +
github.rest.issues.updateComment or use an action like
peter-evans/create-or-update-comment) — update the YAML's on.pull_request.types
and/or replace the createComment call in the "Comment on PR" step so it searches
for an existing comment by the bot and updates it when present.


# Create a channel named after your PR
- name: Create PR Channel
run: bunx @capgo/cli channel add pr-${{ github.event.pull_request.number }} --self-assign
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistency: Best practice not implemented in the example workflow.

Line 217 advises to "Handle failures gracefully: Check that channel creation succeeds before posting comments," but the example workflow (line 78) doesn't implement this check. If channel creation fails (e.g., channel already exists from a previous run), the workflow will still post a comment with instructions for a non-existent or broken channel.

🔧 Suggested fix

Add error handling to the channel creation step:

       # Create a channel named after your PR
       - name: Create PR Channel
+        continue-on-error: true
+        id: create_channel
         run: bunx `@capgo/cli` channel add pr-${{ github.event.pull_request.number }} --self-assign
         env:
           CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}

       # Upload the build to that channel
       - name: Upload to Capgo
+        if: steps.create_channel.outcome == 'success'
         run: bunx `@capgo/cli` bundle upload --channel pr-${{ github.event.pull_request.number }}
         env:
           CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}

       # Post a comment with testing instructions
       - name: Comment on PR
+        if: steps.create_channel.outcome == 'success'
         uses: actions/github-script@v7

Alternatively, use channel add with a flag that doesn't fail if the channel exists (if such a flag is available in the CLI).

Also applies to: 217-217

🤖 Prompt for AI Agents
In `@src/content/blog/en/turn-every-pr-into-installable-preview.md` at line 78,
The workflow's channel creation command (bunx `@capgo/cli` channel add pr-${{
github.event.pull_request.number }} --self-assign) can fail (e.g., channel
already exists) but the example always proceeds to post the comment; update the
"channel add" step to detect success/failure and expose a step output (or use a
non-failing flag if the CLI supports it) and then make the comment/post step
conditional (only run when the create-channel step succeeded). Specifically,
modify the step that runs "bunx `@capgo/cli` channel add pr-${{
github.event.pull_request.number }} --self-assign" to return a clear success
indicator (exit code check, set-output or step outcome) and reference that
indicator in the comment step's if: condition so comments are only posted when
channel creation actually succeeded.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a comprehensive tutorial blog post explaining how to set up PR previews using Capgo's channel system. The article guides developers through automating the deployment of per-PR update channels using GitHub Actions, enabling QA teams, product managers, and stakeholders to test features on real devices without TestFlight delays.

Changes:

  • Added comprehensive tutorial blog post on PR preview implementation
  • Provided GitHub Actions workflows for automated PR preview deployment and cleanup
  • Documented channel switching methods for testers (shake menu and programmatic API)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

author_url: 'https://x.com/martindonadieu'
created_at: 2025-01-22T00:00:00.000Z
updated_at: 2025-01-22T00:00:00.000Z
head_image: /capgo_pr_preview.webp
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The referenced head_image file 'capgo_pr_preview.webp' does not exist in the public directory. This will result in a broken image link when the blog post is published. Please add the image file to the public directory or update the head_image reference to point to an existing image.

Suggested change
head_image: /capgo_pr_preview.webp
head_image: ''

Copilot uses AI. Check for mistakes.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@riderx riderx closed this Jan 22, 2026
@sonarqubecloud
Copy link

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.

1 participant