GitHub Actions
Run Station AI agents directly in your GitHub workflows without installing Station locally. The station-action supports three modes for loading agents.
Quick Start
The easiest way to add a Station agent workflow to your repository is using the CLI:
This interactive command will:
Ask how you want to provide agents (CloudShip bundle ID or local environment)
Help you select an agent to run
Configure the workflow trigger (push, PR, schedule, manual)
Generate .github/workflows/station-agent.yml
Tell you which GitHub secrets to configure
Example session:
$ stn github init
🚀 Station GitHub Actions Setup
================================
How would you like to provide agents?
1. CloudShip Bundle ID (recommended - keeps repo clean)
2. Local environment (agents stored in repo)
Choice [1]: 1
Enter your CloudShip Bundle ID: 970fa728-4276-4443-9e51-35919b650d7a
Enter agent name to run: posthog-dashboard-reporter
When should this workflow run?
1. On push to main branch
2. On pull requests
3. On a schedule (e.g., daily)
4. Manual trigger only
Choice [4]: 4
✅ GitHub Actions workflow created!
📄 File: .github/workflows/station-agent.yml
🔐 Required GitHub Secrets:
OPENAI_API_KEY - Your OpenAI API key
CLOUDSHIP_API_KEY - Your CloudShip API key
Set secrets at: https://github.com/<owner>/<repo>/settings/secrets/actions
Manual Setup
Alternatively, you can manually create the workflow. The simplest approach is using a CloudShip bundle ID:
name : Run AI Agent
on : [ push ]
jobs :
analyze :
runs-on : ubuntu-latest
steps :
- uses : actions/checkout@v4
- uses : cloudshipai/station-action@main
with :
agent : 'posthog-dashboard-reporter'
task : 'List all my dashboards and summarize my analytics setup.'
bundle-id : '970fa728-4276-4443-9e51-35919b650d7a'
cloudship-api-key : ${{ secrets.CLOUDSHIP_API_KEY }}
env :
OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
POSTHOG_API_KEY : ${{ secrets.POSTHOG_API_KEY }}
Agent Source Modes
Station action supports three ways to load agents:
Bundle ID (Recommended)
Bundle URL
Local Environment
Use a bundle published to CloudShip. This is the cleanest approach - no Station files need to be committed to your repository. Step 1: Publish your bundle to CloudShip From your local Station workspace: # Share an environment as a bundle
stn bundle share default
# Output:
# Bundle shared successfully!
# Bundle ID: 970fa728-4276-4443-9e51-35919b650d7a
Step 2: Use the bundle ID in your workflow - uses : cloudshipai/station-action@main
with :
agent : 'my-agent'
task : 'Perform the task'
bundle-id : '970fa728-4276-4443-9e51-35919b650d7a'
cloudship-api-key : ${{ secrets.CLOUDSHIP_API_KEY }}
env :
OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
Download a bundle from any URL (S3, GitHub Releases, etc.): - uses : cloudshipai/station-action@main
with :
agent : 'my-agent'
task : 'Perform the task'
bundle-url : 'https://github.com/myorg/myrepo/releases/download/v1.0.0/bundle.tar.gz'
env :
OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
Creating a bundle for URL distribution: # Build a bundle locally
stn bundle build default -o ./my-bundle.tar.gz
# Upload to your release/storage
gh release upload v1.0.0 ./my-bundle.tar.gz
Use agents defined in your repository’s environments/ folder: - uses : cloudshipai/station-action@main
with :
agent : 'my-agent'
task : 'Perform the task'
environment : 'default'
env :
OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
Repository structure: your-repo/
├── environments/
│ └── default/
│ ├── agents/
│ │ └── my-agent.yaml
│ └── mcp/
│ └── my-tools.yaml
└── .github/
└── workflows/
└── agent.yml
This mode is useful when you want to version control your agents alongside your application code.
Input Description Required Default agentAgent name to run Yes - taskTask description for the agent Yes - bundle-idCloudShip bundle ID No* - bundle-urlURL to download bundle from No* - environmentLocal environment name No* defaultcloudship-api-keyCloudShip API key (for bundle-id mode) No - providerAI provider (openai, anthropic, gemini, ollama) No openaimodelModel override No Provider default base-urlCustom API endpoint No - timeoutExecution timeout in seconds No 300max-stepsMaximum agent steps No 50
*At least one of bundle-id, bundle-url, or environment must be specified. If none are provided, the action looks for a local environments/default folder.
AI Provider Configuration
OpenAI
Anthropic
Google Gemini
- uses : cloudshipai/station-action@main
with :
agent : 'my-agent'
task : 'Analyze the codebase'
bundle-id : 'your-bundle-id'
cloudship-api-key : ${{ secrets.CLOUDSHIP_API_KEY }}
provider : 'openai'
model : 'gpt-4o'
env :
OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
- uses : cloudshipai/station-action@main
with :
agent : 'my-agent'
task : 'Analyze the codebase'
bundle-id : 'your-bundle-id'
cloudship-api-key : ${{ secrets.CLOUDSHIP_API_KEY }}
provider : 'anthropic'
model : 'claude-sonnet-4-20250514'
env :
ANTHROPIC_API_KEY : ${{ secrets.ANTHROPIC_API_KEY }}
- uses : cloudshipai/station-action@main
with :
agent : 'my-agent'
task : 'Analyze the codebase'
bundle-id : 'your-bundle-id'
cloudship-api-key : ${{ secrets.CLOUDSHIP_API_KEY }}
provider : 'gemini'
model : 'gemini-2.0-flash-exp'
env :
GOOGLE_API_KEY : ${{ secrets.GOOGLE_API_KEY }}
Complete Examples
Analytics Reporter
Run a PostHog analytics agent to summarize your dashboards:
name : Weekly Analytics Report
on :
schedule :
- cron : '0 9 * * 1' # Monday 9 AM
workflow_dispatch :
jobs :
report :
runs-on : ubuntu-latest
steps :
- uses : cloudshipai/station-action@main
with :
agent : 'posthog-dashboard-reporter'
task : |
Generate a weekly analytics report:
1. List all dashboards
2. Summarize key metrics from each
3. Highlight any significant changes
bundle-id : '970fa728-4276-4443-9e51-35919b650d7a'
cloudship-api-key : ${{ secrets.CLOUDSHIP_API_KEY }}
env :
OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
POSTHOG_API_KEY : ${{ secrets.POSTHOG_API_KEY }}
PR Code Review
Review pull requests automatically:
name : AI Code Review
on :
pull_request :
types : [ opened , synchronize ]
jobs :
review :
runs-on : ubuntu-latest
permissions :
contents : read
pull-requests : write
steps :
- uses : actions/checkout@v4
with :
fetch-depth : 0
- uses : cloudshipai/station-action@main
with :
agent : 'code-reviewer'
task : |
Review the changes in this PR. Focus on:
- Security vulnerabilities
- Performance issues
- Code quality and best practices
- Potential bugs
bundle-id : 'your-code-review-bundle-id'
cloudship-api-key : ${{ secrets.CLOUDSHIP_API_KEY }}
env :
OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
Security Scan on Push
Scan for security issues on every push:
name : Security Scan
on :
push :
branches : [ main ]
jobs :
scan :
runs-on : ubuntu-latest
steps :
- uses : actions/checkout@v4
- uses : cloudshipai/station-action@main
with :
agent : 'security-scanner'
task : 'Scan the codebase for security vulnerabilities, exposed secrets, and dependency issues'
bundle-id : 'your-security-bundle-id'
cloudship-api-key : ${{ secrets.CLOUDSHIP_API_KEY }}
timeout : '600'
env :
OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
Publishing Bundles to CloudShip
To use bundle-id mode, first publish your agents to CloudShip:
# 1. Create agents in your local Station workspace
stn init
stn agent add --name "my-agent" --description "Does something useful"
# 2. Add MCP tools
stn mcp add --name "my-tools" --url "https://api.example.com/mcp"
# 3. Test locally
stn run "my-agent" --task "Test the agent"
# 4. Share to CloudShip
stn bundle share default
# Output shows your bundle ID:
# Bundle ID: abc123-def456-...
Store your bundle ID somewhere safe. You’ll need it for the bundle-id input in your workflows.
Build-Time Actions
Station also provides reusable actions for building bundles and Docker images.
Build Bundle
Create distributable bundles from environments:
- uses : cloudshipai/station/.github/actions/build-bundle@main
id : bundle
with :
environment : 'production'
version : '1.0.0'
- run : echo "Bundle created at ${{ steps.bundle.outputs.bundle-path }}"
Build Docker Image
Build and push Docker images:
- uses : cloudshipai/station/.github/actions/build-image@main
with :
source-type : 'environment'
environment : 'production'
image-name : 'my-org/station-production'
image-tag : 'latest'
push : 'true'
registry-username : ${{ github.actor }}
registry-password : ${{ secrets.GITHUB_TOKEN }}
Setup Station CLI
Install Station CLI without running an agent:
- uses : cloudshipai/station/.github/actions/setup-station@main
with :
version : 'latest'
env :
OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
- run : stn --version
Best Practices
Use bundle-id mode for production
Bundle-id mode keeps your repository clean - no Station configuration files to maintain. Agents are versioned separately in CloudShip.
Store API keys as GitHub secrets
Never hardcode API keys. Use GitHub secrets: env :
OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
CLOUDSHIP_API_KEY : ${{ secrets.CLOUDSHIP_API_KEY }}
Complex tasks may need longer timeouts: with :
timeout : '600' # 10 minutes
Use workflow_dispatch for testing
Add manual trigger for easy testing: on :
workflow_dispatch :
push :
branches : [ main ]
Troubleshooting
Ensure the agent name matches exactly (case-sensitive). List available agents:
For bundle-id mode, verify:
cloudship-api-key is set correctly
Bundle ID is valid and not deleted
Your CloudShip account has access to the bundle
Next Steps