Skip to main content

GitHub Action

Get a full staging environment for every GitHub PR. When you open a PR, Autodock clones your repo, runs Claude Code to set it up, and posts the preview URL as a comment. Push more commits and it syncs automatically. Close the PR and the environment is destroyed.
Mike’s tip: The GitHub Action is powered by a RAG engine that indexes six months of real deployment failures by yours truly and some of my friends. If you can imagine it, chances are that we’ve messed it up, which means Autodock knows how to guide an LLM to fix it.

Quick Start

  1. Get an API token at autodock.io/preview-setup
  2. Add AUTODOCK_TOKEN to your repository secrets
  3. (Optional) Add AUTODOCK_ENV secret with your .env file content
  4. Create .github/workflows/preview.yml:
name: Preview

on:
  pull_request:
    types: [opened, synchronize, reopened, closed]

jobs:
  preview:
    runs-on: ubuntu-latest
    if: github.event.pull_request.head.repo.full_name == github.repository
    steps:
      - name: Deploy Preview
        if: github.event.action != 'closed'
        uses: mikesol/autodock-preview@v1
        with:
          autodock_token: ${{ secrets.AUTODOCK_TOKEN }}
          branch: ${{ github.head_ref }}
          env_file: ${{ secrets.AUTODOCK_ENV }} # Optional

      - name: Cleanup Preview
        if: github.event.action == 'closed'
        uses: mikesol/autodock-preview@v1
        with:
          autodock_token: ${{ secrets.AUTODOCK_TOKEN }}
          action: cleanup

How It Works

  1. PR opened: Creates a new environment, clones your PR branch, runs Claude Code to detect and set up your project
  2. PR pushed: Pulls latest changes, runs Claude Code to handle updates (migrations, deps, etc.)
  3. PR closed: Environment is destroyed automatically
  4. Idle timeout: Previews auto-expire after 24 hours of inactivity

Inputs

InputDescriptionRequiredDefault
autodock_tokenYour Autodock API tokenYes-
actiondeploy or cleanupNodeploy
branchPR source branchNogithub.head_ref
timeoutMinutes to wait for preview to become readyNo10
env_fileEnvironment variables in .env formatNo-

Outputs

OutputDescription
preview_urlThe preview environment URL
environment_idThe Autodock environment ID
slugThe environment slug

Environment Variables

Pass secrets and configuration to your preview via the AUTODOCK_ENV secret:
DATABASE_URL=postgresql://...
API_KEY=sk-xxx
NEXT_PUBLIC_API_URL=https://api.example.com
These variables are exported into the shell environment before Claude sets up your project, so any commands it runs will have access to them.

What Gets Set Up

Claude Code analyzes your repository and automatically:
  • Detects your framework (Next.js, Django, Rails, FastAPI, etc.)
  • Installs dependencies
  • Runs database migrations
  • Starts dev servers
  • Exposes the right ports
No configuration files needed. If your project has an AUTODOCK.md file with custom instructions, Claude will follow those instead.

PR Comments

Autodock posts a comment on your PR with:
  • Preview URL
  • Setup summary
  • Any exposed ports and their URLs
The comment is updated on each push with the latest status.

Limitations

  • Single-repo previews only (multi-repo coming soon)
  • Public repositories only (private repo support coming soon)

Troubleshooting

Preview is stuck in “provisioning” The 10-minute timeout should be enough for most projects. If it’s taking longer, your setup might have an issue. Check the Autodock dashboard for logs. Environment variables not working Make sure AUTODOCK_ENV is set as a repository secret (not an environment secret) and contains valid .env format content. Preview URL returns 502 Your dev server might not be running or might be bound to localhost. Autodock exposes ports bound to 0.0.0.0. Check the dashboard logs to see what Claude set up.