A reusable composite GitHub Action that starts OpenHands conversations from prompts or files, with optional polling until completion.
- π Simple Integration: Start OpenHands conversations directly from your GitHub workflows
- π Flexible Prompts: Use literal text or file paths for prompts
- π Automatic Polling: Optionally poll conversations until they complete
- π― Repository Targeting: Specify which repository OpenHands should work with
- π Secure: Uses GitHub secrets for API keys
- π Outputs: Returns conversation ID and status for downstream steps
- name: Run OpenHands conversation
uses: All-Hands-AI/openhands-github-action@v1
with:
prompt: "Please review the code and suggest improvements"
openhands-api-key: ${{ secrets.OPENHANDS_API_KEY }}| Input | Description | Required | Default |
|---|---|---|---|
prompt |
Prompt text or path to a prompt file | β | - |
repository |
Repo to pass to OpenHands | β | Current repository |
selected-branch |
Branch to pass to OpenHands | β | - |
base-url |
OpenHands API base URL | β | https://app.all-hands.dev |
poll |
Poll conversation until it stops (true/false) | β | true |
timeout-seconds |
Polling timeout in seconds | β | 1200 |
poll-interval-seconds |
Polling interval in seconds | β | 30 |
github-token |
GitHub token (reserved for future features) | β | - |
openhands-api-key |
OpenHands API key | β | - |
| Output | Description |
|---|---|
conversation-id |
Created conversation ID |
status |
Final (or last-seen) conversation status |
conversation-url |
URL to view the conversation in the web interface |
name: Code Review
on: [push]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run code review
uses: All-Hands-AI/openhands-github-action@v1
with:
prompt: "Please review the recent changes and provide feedback"
openhands-api-key: ${{ secrets.OPENHANDS_API_KEY }}name: Documentation Update
on:
schedule:
- cron: "0 9 * * 1" # Weekly on Mondays
jobs:
update-docs:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Update documentation
uses: All-Hands-AI/openhands-github-action@v1
with:
prompt: scripts/prompts/update_docs.md
repository: ${{ github.repository }}
selected-branch: main
openhands-api-key: ${{ secrets.OPENHANDS_API_KEY }}name: Complex Task
on: workflow_dispatch
jobs:
complex-task:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run complex OpenHands task
id: openhands
uses: All-Hands-AI/openhands-github-action@v1
with:
prompt: |
Please analyze the codebase and:
1. Identify potential security vulnerabilities
2. Suggest performance improvements
3. Update the README with your findings
repository: ${{ github.repository }}
selected-branch: ${{ github.ref_name }}
base-url: https://app.all-hands.dev
poll: "true"
timeout-seconds: "1800"
poll-interval-seconds: "45"
github-token: ${{ secrets.GITHUB_TOKEN }}
openhands-api-key: ${{ secrets.OPENHANDS_API_KEY }}
- name: Use outputs
run: |
echo "Conversation ID: ${{ steps.openhands.outputs.conversation-id }}"
echo "Final Status: ${{ steps.openhands.outputs.status }}"
echo "View conversation: ${{ steps.openhands.outputs.conversation-url }}"name: Fire and Forget
on: workflow_dispatch
jobs:
start-task:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Start OpenHands task
uses: All-Hands-AI/openhands-github-action@v1
with:
prompt: "Start working on the feature request in issue #123"
poll: "false" # Don't wait for completion
openhands-api-key: ${{ secrets.OPENHANDS_API_KEY }}- Sign up at app.all-hands.dev
- Generate an API key from your account settings
- Add it to your repository secrets as
OPENHANDS_API_KEY
Go to your repository settings β Secrets and variables β Actions, and add:
OPENHANDS_API_KEY: Your OpenHands API key
Optionally, you may also want to ensure GITHUB_TOKEN is available for future features.
Make sure your workflow has appropriate permissions:
permissions:
contents: write # If OpenHands needs to modify files
pull-requests: write # If OpenHands needs to create/update PRsYou can use prompt files for complex or reusable prompts. Create a file (e.g., scripts/prompts/code_review.md) with your prompt content:
# Code Review Prompt
Please review the recent changes in this repository and:
1. Check for potential bugs or issues
2. Suggest improvements for code quality
3. Verify that tests are adequate
4. Update documentation if needed
Focus on:
- Security best practices
- Performance considerations
- Code maintainabilityThen reference it in your workflow:
with:
prompt: scripts/prompts/code_review.md
openhands-api-key: ${{ secrets.OPENHANDS_API_KEY }}The action returns these possible status values:
RUNNING: Conversation is still activeSTOPPED: Conversation completed successfullyFAILED: Conversation failed due to an errorERROR: System error occurredCANCELLED: Conversation was cancelledUNKNOWN: Status could not be determined
The action will:
- Exit with code 2 for configuration errors (missing API key, invalid inputs)
- Exit with code 1 for API errors or terminal conversation states (
FAILED,ERROR,CANCELLED) - Exit with code 0 for successful completion
This action is maintained by All Hands AI. For issues, feature requests, or contributions, please visit the repository.
This project is licensed under the MIT License - see the LICENSE file for details.
- π OpenHands Documentation
- π¬ Community Discord
- π¬ Join our Slack
- π Report Issues