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
- Get an API token at autodock.io/preview-setup
- Add
AUTODOCK_TOKEN to your repository secrets
- (Optional) Add
AUTODOCK_ENV secret with your .env file content
- 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
- PR opened: Creates a new environment, clones your PR branch, runs Claude Code to detect and
set up your project
- PR pushed: Pulls latest changes, runs Claude Code to handle updates (migrations, deps, etc.)
- PR closed: Environment is destroyed automatically
- Idle timeout: Previews auto-expire after 24 hours of inactivity
| Input | Description | Required | Default |
|---|
autodock_token | Your Autodock API token | Yes | - |
action | deploy or cleanup | No | deploy |
branch | PR source branch | No | github.head_ref |
timeout | Minutes to wait for preview to become ready | No | 10 |
env_file | Environment variables in .env format | No | - |
Outputs
| Output | Description |
|---|
preview_url | The preview environment URL |
environment_id | The Autodock environment ID |
slug | The 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.
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.