An AI-powered bot for your GitHub repository, powered by real OpenClaw β the same agent framework that powers WhatsApp bots, Discord bots, and personal assistants.
This GitHub Action brings OpenClaw to your repository. Instead of being a standalone agent implementation, this is a thin wrapper that:
- Installs OpenClaw in GitHub Actions
- Starts the OpenClaw Gateway
- Translates GitHub events into messages
- Sends them to OpenClaw via WebSocket
- Posts the agent's response back to GitHub
Why this matters: You get the full power of OpenClaw β the same reasoning, memory system, and capabilities β now available in your GitHub workflows.
Provider-agnostic: Works with Anthropic, xAI, OpenAI, Google, Groq, OpenRouter, Cerebras, and Mistral.
- π€ Real OpenClaw β same agent, same capabilities
- π Multi-provider β use Anthropic, xAI, OpenAI, Google, or others
- π Persistent memory β maintains context across runs via GitHub Actions Cache
- π Rich repo context β automatically includes README, recent commits, and open issues
- π PR code review β analyzes diffs and posts inline review comments
- βοΈ Configurable β customize behavior via
.openclaw.yml - π Heartbeat checks β periodic reviews of your repo
- π¬ Issue/PR responses β intelligent comments on issues and pull requests
- π§ Learning β builds up memory and understanding of your project over time
Create .github/workflows/openclaw.yml:
name: OpenClaw Bot
on:
issues:
types: [opened, edited]
issue_comment:
types: [created]
pull_request:
types: [opened, synchronize, reopened]
pull_request_review_comment:
types: [created]
schedule:
- cron: '0 */6 * * *' # Every 6 hours
workflow_dispatch:
inputs:
message:
description: 'Custom message to send to the agent'
required: false
default: 'Manual trigger - review the repo'
permissions:
contents: read
issues: write
pull-requests: write
jobs:
openclaw:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: offloadmywork/openclaw-github-app@main
with:
api_key: ${{ secrets.ANTHROPIC_API_KEY }}
provider: 'anthropic'
model: 'claude-sonnet-4-5'
github_token: ${{ secrets.GITHUB_TOKEN }}| Input | Description | Required | Default |
|---|---|---|---|
api_key |
API key for your chosen provider | Yes | - |
provider |
AI provider (anthropic, xai, openai, google, groq, etc.) | No | anthropic |
model |
Model to use (e.g., claude-sonnet-4-5, grok-3-fast) | No | Provider default |
github_token |
GitHub token for API access | No | ${{ github.token }} |
| Provider | Example Models | Secret Name |
|---|---|---|
anthropic |
claude-sonnet-4-5, claude-opus-4-5 |
ANTHROPIC_API_KEY |
xai |
grok-3-fast, grok-3-medium |
XAI_API_KEY |
openai |
gpt-4.1-mini, gpt-4.1 |
OPENAI_API_KEY |
google |
gemini-2.5-flash, gemini-2.5-pro |
GEMINI_API_KEY |
groq |
llama-3.3-70b-versatile |
GROQ_API_KEY |
openrouter |
anthropic/claude-sonnet-4-5 |
OPENROUTER_API_KEY |
Note: Model names can include or omit the provider prefix. For example, both claude-sonnet-4-5 and anthropic/claude-sonnet-4-5 work.
Add your API key to repository secrets:
- Go to Settings β Secrets and variables β Actions
- Click "New repository secret"
- Name:
ANTHROPIC_API_KEY(or your provider's key name) - Value: Your API key
- uses: offloadmywork/openclaw-github-app@main
with:
api_key: ${{ secrets.XAI_API_KEY }}
provider: 'xai'
model: 'grok-3-fast'
github_token: ${{ secrets.GITHUB_TOKEN }}- uses: offloadmywork/openclaw-github-app@main
with:
api_key: ${{ secrets.OPENAI_API_KEY }}
provider: 'openai'
model: 'gpt-4.1-mini'
github_token: ${{ secrets.GITHUB_TOKEN }}- uses: offloadmywork/openclaw-github-app@main
with:
api_key: ${{ secrets.GEMINI_API_KEY }}
provider: 'google'
model: 'gemini-2.5-flash'
github_token: ${{ secrets.GITHUB_TOKEN }}GitHub Event β GitHub Actions β Install OpenClaw
β
Start Gateway (localhost:18789)
β
Restore workspace from cache
β
Translate event β message
β
Send to OpenClaw via WebSocket
β
Wait for agent response
β
Post response to GitHub
β
Save workspace to cache
β
Stop Gateway
OpenClaw maintains a workspace in .openclaw/ with:
SOUL.mdβ the bot's identity and purposeMEMORY.mdβ curated long-term memorymemory/YYYY-MM-DD.mdβ daily logs
This workspace is cached per branch using GitHub Actions Cache, giving the bot continuity and context across runs on the same branch.
Important: Cache is branch-specific. Each branch has its own memory, so the bot doesn't get confused by branch-specific work.
The bot responds to:
- Schedule β Heartbeat check (reviews repo, looks for work)
- Issue comment β Responds to comments
- Issue opened/edited β Welcomes and provides guidance
- Pull request β Reviews and provides feedback
- PR review comments β Participates in code reviews
- Manual β Workflow dispatch for manual triggers
After the first run, the bot creates SOUL.md in its workspace. You can customize this by:
- Running the action once
- Checking the workspace (it's in the cache, but you can add a step to commit it)
- Editing
SOUL.mdto define the bot's personality and purpose
# SOUL.md - Who Am I?
I am the OpenClaw bot for [Your Project].
## Purpose
I help maintain this repository by:
- Welcoming new contributors
- Answering common questions
- Reviewing PRs for best practices
- Keeping the team informed
## Personality
I'm friendly, helpful, and focused on making contributors successful.
I use clear language and avoid jargon unless necessary.The bot automatically builds context about your repository including README, recent commits, and open issues. You can customize this behavior by creating .openclaw.yml (or .github/openclaw.yml):
# Custom system prompt for your project
system_prompt: |
You are a code reviewer for a TypeScript project.
Focus on type safety, error handling, and performance.
Always suggest specific improvements with code examples.
# Control what context is included
context:
include_readme: true # Include README.md content (default: true)
readme_max_chars: 4000 # Max chars for README (default: 4000)
recent_commits: 10 # Number of recent commits to include (default: 10)
open_issues: true # Include open issues list (default: true)
max_issues: 15 # Max number of issues to include (default: 15)| Option | Type | Default | Description |
|---|---|---|---|
system_prompt |
string | - | Custom instructions for the bot |
context.include_readme |
boolean | true |
Include README.md content |
context.readme_max_chars |
number | 4000 |
Maximum characters from README |
context.recent_commits |
number | 10 |
Number of recent commits to show |
context.open_issues |
boolean | true |
Include open issues list |
context.max_issues |
number | 15 |
Maximum open issues to show |
The context is automatically injected into every message, giving the bot awareness of your project's purpose, recent activity, and current work.
When a pull request is opened or updated, the bot automatically:
- Fetches the full diff
- Analyzes the code changes
- Posts a structured review with inline comments
The review includes:
- Summary β Overall assessment of the PR
- Inline comments β Specific feedback on individual lines
- Verdict β
approve,request_changes, orcomment
Example review output:
π€ OpenClaw Bot Review
The PR looks good overall. A few suggestions:
**src/utils.ts:42**
Consider using `const` instead of `let` here since the value is never reassigned.
**src/api.ts:78**
This error handling could be more specific. Consider catching `NetworkError` separately.
The bot uses GitHub's native review system, so comments appear directly on the relevant lines in the PR diff view.
Add a HEARTBEAT.md to your .openclaw/ workspace to define what the bot should check during heartbeats:
# Heartbeat Tasks
Check every 6 hours:
- Open issues without labels
- PRs waiting for review >48h
- Questions in discussionsThe bot automatically maintains:
- Daily logs in
memory/YYYY-MM-DD.md - Long-term memory in
MEMORY.md
You can review and curate these files to guide the bot's understanding of your project.
The action requires these permissions:
permissions:
contents: read # Read repository files
issues: write # Comment on issues
pull-requests: write # Comment on PRsIf your workflow needs additional permissions (e.g., to create branches), add them explicitly.
Before (Standalone Agent):
- Custom implementation using provider SDK
- Manual prompt engineering
- Limited capabilities
- Hard to maintain/extend
Now (OpenClaw Wrapper):
- Full OpenClaw agent with all capabilities
- Shared codebase with other OpenClaw deployments
- Automatic updates when OpenClaw improves
- Same agent across all platforms (WhatsApp, Discord, GitHub)
- Provider-agnostic (switch models/providers easily)
If the bot seems to have lost its memory:
- Check the Actions cache (Settings β Actions β Caches)
- Cache is branch-specific β each branch has separate memory
- Cache entries expire after 7 days of no use
If the bot times out:
- Default timeout is 15 minutes (adjust with
timeout-minutes) - The bot has a 120-second lifecycle timeout for agent responses
- Check Gateway logs for errors
Make sure:
- The secret name matches your provider (e.g.,
ANTHROPIC_API_KEYfor Anthropic) - The secret is set at repository or organization level
- The API key has sufficient credits/quota
# Clone the repository
git clone https://github.com/offloadmywork/openclaw-github-app.git
cd openclaw-github-app
# Install dependencies
npm install
# Build the action
npm run build
# Type check
npm run typecheckThe action uses esbuild to bundle the TypeScript source into dist/index.js. When making changes:
- Edit source files in
src/ - Run
npm run buildto compile - Test the action in a test repository
- Commit both source and dist changes
- Push to
main(or create a tagged release)
Important: Always commit the dist/ directory and node_modules/ with your changes. GitHub Actions need these to run.
# After testing your changes
git add src/ dist/ node_modules/
git commit -m "feat: your feature description"
git push origin main
# Create a tagged release (optional, for version pinning)
git tag -a v1.2.3 -m "Release v1.2.3"
git push origin v1.2.3Users can then reference specific versions:
@mainβ latest (may have breaking changes)@v1β major version (recommended)@v1.2.3β exact version (most stable)
You can test the action locally:
- Install OpenClaw globally:
npm install -g openclaw - Set required environment variables:
export INPUT_API_KEY=your_api_key export INPUT_PROVIDER=anthropic export INPUT_MODEL=claude-sonnet-4-5 export GITHUB_TOKEN=your_github_token export GITHUB_REPOSITORY=owner/repo
- Run:
node dist/index.js
Create a test repository and add a workflow file (.github/workflows/openclaw.yml) that uses your fork:
- uses: your-username/openclaw-github-app@your-branch
with:
api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}The action automatically caches:
- OpenClaw installation β Speeds up subsequent runs by ~30-60s
- Workspace files β Maintains bot memory and context across runs
Cache keys are stable and version-pinned, so cache invalidation happens automatically when OpenClaw updates.
Want to customize the bot or host your own version? Here's how:
Click "Fork" on GitHub or:
gh repo fork offloadmywork/openclaw-github-app --cloneEdit files in src/ to customize behavior:
src/triggers.tsβ Modify what events trigger the botsrc/index.tsβ Change bot installation/setup logicsrc/gateway.tsβ Adjust OpenClaw configuration
Then rebuild:
npm run build
git add src/ dist/
git commit -m "feat: custom behavior"
git pushIn your workflows, reference your fork:
- uses: your-username/openclaw-github-app@main
with:
api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}Sync your fork periodically:
gh repo sync your-username/openclaw-github-appOr set up GitHub Actions to auto-sync your fork.
If you forked the repo, you can create a workflow in your fork that automatically sets it up in new repositories:
- Add
.github/workflows/setup-openclaw.ymlto your fork - Use
workflow_dispatchto trigger setup - The workflow can commit the OpenClaw workflow file to target repos
This enables "install with one click" for all your repositories.
This is a thin wrapper β most improvements should go to OpenClaw itself. But wrapper-specific improvements are welcome!
- Fork the repository
- Create a feature branch
- Make your changes
- Run
npm run buildandnpm run typecheck - Test in a real repository
- Submit a pull request
- Performance β Faster installs, better caching
- Features β New trigger types, configuration options
- Documentation β Clearer guides, more examples
- Bug Fixes β Error handling, edge cases
MIT
- Issues: https://github.com/offloadmywork/openclaw-github-app/issues
- OpenClaw Docs: https://openclaw.dev
- Discord: Join the OpenClaw community