Quickstart: preview action
Start Antidote automatically for pull request previews.
Use this workflow when each pull request gets its own preview deployment.
1. Add Preview deployments to the product
Before the first run, an org admin opens Product settings (the cog next to the product menu), goes to Environments, selects Add environment, sets Type to Preview deployments and selects Create. All pull-request previews share this one slot. Until it exists, the preview action stops with "Add Preview deployments in Product settings → Environments before using the preview action."
3. Create the workflow file
Copy this file into .github/workflows/duku-preview.yml:
name: Duku preview
on:
pull_request:
types: [opened, synchronize, reopened]
branches: [main]
concurrency:
group: duku-preview-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
preview:
name: Duku preview
runs-on: ubuntu-latest
# The action exits in seconds; this cap only guards against network hangs.
timeout-minutes: 5
permissions:
contents: read
pull-requests: read # for preview URL resolution
deployments: read # required for preview URL resolution
checks: read # for preview URL resolution
statuses: read # for preview URL resolution
steps:
- uses: actions/checkout@v4
- name: Duku preview
id: preview
uses: duku-ai/actions/preview@preview/v0.5.0
with:
api-key: ${{ secrets.PLATFORM_API_KEY }}
product-id: ${{ vars.PLATFORM_PRODUCT_ID }}
github-token: ${{ github.token }}
# Optional: bypass Vercel Deployment Protection on protected previews.
# vercel-automation-bypass-secret: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}4. Update the workflow values
branches: [main]should match the branch you merge into.api-keyreads the repository secretPLATFORM_API_KEY.product-idreads the repository variablePLATFORM_PRODUCT_ID.
github-token lets the action find the PR's preview URL, so it is required on pull_request runs unless you pass exploration-url. The read permissions above are all it needs - the Duku GitHub App posts the PR comment.
deployments: read, checks: read, and statuses: read let the action resolve the preview URL.
PRs opened from forks cannot read repository secrets. Duku previews require a PR from a branch in the same repository.
Preview URL resolution
On a pull request, the preview action figures out which deployed URL to explore.
With preview-url-source: auto, it checks the PR head commit's GitHub Deployments, then Checks (when preview-check-name-regex is set), then Statuses (when preview-status-context-regex is set). auto never reads PR comments.
You can force a single source. You can also set exploration-url to skip resolution entirely.
Example: resolve the URL from Vercel comments
- uses: duku-ai/actions/preview@preview/v0.5.0
with:
api-key: ${{ secrets.PLATFORM_API_KEY }}
product-id: ${{ vars.PLATFORM_PRODUCT_ID }}
github-token: ${{ github.token }}
preview-url-source: 'comments'
preview-comment-author-logins: 'vercel[bot]'auto is usually the right choice. Use comments when your deployment provider does not publish a usable GitHub Deployment.
Read next
Last updated

