Skip to content

Repository files navigation

dobbyphus

A reusable GitHub Action that runs AI agents using opencode + oh-my-opencode.

Quick Start

name: AI Agenton:
workflow_dispatch:
inputs:
prompt:
description: Custom prompt to runrequired: falseissue_number:
description: Issue/PR number to comment onrequired: falseissue_comment:
types: [created]pull_request:
types: [review_requested]pull_request_review:
types: [submitted]pull_request_review_comment:
types: [created]jobs:
agent:
if: >- github.event_name == 'workflow_dispatch' || (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@ai-agent') && github.event.comment.user.login != 'github-actions[bot]' && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) || (github.event_name == 'pull_request' && github.event.requested_reviewer.login == 'github-actions[bot]') || (github.event_name == 'pull_request_review' && github.event.review.user.login != 'github-actions[bot]' && contains(github.event.review.body, '@ai-agent')) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@ai-agent') && github.event.comment.user.login != 'github-actions[bot]' && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association))runs-on: ubuntu-latestpermissions:
contents: writeissues: writepull-requests: writesteps:
- uses: actions/checkout@v6with:
ref: ${{ github.head_ref || github.ref }}fetch-depth: 0
- uses: dobbyphus/action@mainwith:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}bot_name: ai-agentbot_login: github-actions[bot]

See examples/agent.yaml for a complete workflow with mode detection and GitHub App token comments.

Inputs

InputDefaultDescription
bot_nameai-agentBot name for labels and mentions
bot_login""Review author login; required for pull_request review events when it cannot be inferred
mention_usersfalseWhether to @mention users in comments (reduces notification noise when false)
anthropic_api_key-Anthropic API key
openai_api_key-OpenAI API key
gemini_api_key-Google Gemini API key
provider_anthropicmax20Anthropic provider setting (no/yes/max20)
provider_openainoOpenAI provider setting (no/yes)
provider_googlenoGoogle provider setting (no/yes)
provider_copilotnoGitHub Copilot provider setting (no/yes)
provider_opencode_zennoOpenCode Zen provider setting (no/yes)
provider_zai_coding_plannoZ.ai Coding Plan provider setting (no/yes)
provider_kimi_for_codingnoKimi for Coding provider setting (no/yes)
provider_opencode_gonoOpenCode Go provider setting (no/yes)
anthropic_base_url-Custom Anthropic API base URL (for proxies)
openai_base_url-Custom OpenAI API base URL (for proxies)
primary_model-Override opencode.json model
modeagentPrompt mode (maps to {prompt_path}/{mode}.md)
prompt-Direct prompt text (alternative to mode)
prompt_path.github/promptsPath to prompts directory
prompt_vars-JSON object for template substitution
github_tokengithub.tokenGitHub token for API access
opencode_versionlatestOpenCode version to install
oh_my_opencode_versionlatestoh-my-opencode version to install
config_json-Full opencode.json content (advanced)
enabled_providers-JSON array of provider IDs to enable
disabled_providers-JSON array of provider IDs to disable
omo_config_json-Full oh-my-openagent.json content (advanced)
auth_json-Full auth.json content (advanced)
agent_keywordsultraworkKeywords to prepend for agent mode (triggers oh-my-opencode modes)
review_keywordsanalyzeKeywords to prepend for review mode (triggers oh-my-opencode modes)
skill_enable_git_masterfalseEnable git-master builtin skill (true/false)
skill_enable_playwrightfalseEnable playwright builtin skill (true/false)
skill_enable_frontend_ui_uxfalseEnable frontend-ui-ux builtin skill (true/false)
format_outputtrueFormat output with collapsible sections for GitHub Actions logs
opencode_print_logsfalseInclude raw opencode runtime logs (--print-logs) in agent runs. GitHub debug reruns also enable this automatically.

How It Works

The action handles everything in a single step:

  1. Setup: Collects context from the trigger event, configures git, adds 👀 reaction
  2. Run: Executes the AI agent with the configured prompt
  3. Teardown: Replays commits as signed, creates PRs, updates reaction to 👍 or 😕

Modes

The action supports two modes via the mode input:

ModeUse CasePrompt
agentIssue comments, PR comments, workflow dispatchWork on requests, make changes
reviewPR review requests and review commentsReview code, provide feedback

Trigger Conditions

Use job-level if to control when the agent runs. The example covers:

  • workflow_dispatch: Always run on manual trigger
  • issue_comment: @mention by authorized user
  • pull_request: Review requested / reviewer assigned
  • pull_request_review: @mention in review body
  • pull_request_review_comment: @mention in inline diff comment

Branch & PR Workflow

The agent must create a branch for any changes. Direct commits to the default branch are blocked.

  1. Agent creates a branch: git checkout -b fix/issue-42
  2. Agent makes commits with meaningful messages
  3. Action automatically:
    • Replays commits as signed via GitHub API
    • Creates the branch on remote if new
    • Opens a pull request to the default branch

Signed Commits

All commits are signed and verified by GitHub. The agent commits normally using git commit, and the action replays each commit through the GitHub API, which signs them automatically.

Workflow by Trigger

TriggerModeAgent ShouldAction Does
Issue commentagentCreate branch, commitPush branch, create PR
PR commentagentCommit to PR branchPush to PR branch
PR inline commentreviewReview code, respondReply in thread
Workflow dispatchagentCreate branch, commitPush branch, create PR
Review requestreviewReview codePost review comment
Review body mentionreviewReview codePost review comment

Configuration

Repository Variables

Set these in Settings → Secrets and variables → Variables:

VariableDefaultDescription
BOT_NAMEai-agentBot mention trigger and label prefix
BOT_LOGINgithub-actions[bot]Bot login to prevent self-triggering

pull_request review events do not identify the review author. Pass bot_login explicitly so the action can verify that review mode posted a new PR review.

Authentication

The action accepts a github_token input. Choose the right token for your use case:

Default Token

The simplest option. Uses the automatic GITHUB_TOKEN:

- uses: dobbyphus/action@mainwith:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

Limitations: Cannot trigger other workflows, limited API rate, commits attributed to github-actions[bot].

GitHub App Token

For production use. Provides higher API limits, can trigger workflows, and commits are attributed to your app:

- uses: actions/create-github-app-token@v1id: app-tokenwith:
app-id: ${{ vars.APP_ID }}private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v6with:
ref: ${{ github.head_ref || github.ref }}fetch-depth: 0token: ${{ steps.app-token.outputs.token }}
- uses: dobbyphus/action@mainwith:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}github_token: ${{ steps.app-token.outputs.token }}bot_login: my-app[bot]

Setup: Create a GitHub App with contents: write, issues: write, pull-requests: write permissions. Store the App ID in a variable and the private key as a secret.

See the commented section in examples/agent.yaml for the complete pattern.

Personal Access Token

For individual use or cross-repository access:

- uses: dobbyphus/action@mainwith:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}github_token: ${{ secrets.PAT_TOKEN }}

Prompt Templating

Templates use {{ variable }} syntax with multi-pass resolution:

# {{ title }}
{{ base_github_env }}
Hello @{{ author }}, working on {{ task }}...

Base Snippets

Place .md files in prompts/base/ to create reusable snippets:

.github/prompts/
├── base/
│ └── my_rules.md → {{ base_my_rules }}
├── agent.md
└── review.md

For project conventions, use AGENTS.md in the repository root instead. The agent checks for AGENTS.md, CLAUDE.md, and COPILOT.md automatically.

Override Priority

Variables are merged with later sources overriding earlier ones:

  1. Action's prompts/base/*.md (lowest priority)
  2. Consumer's prompt_path/base/*.md
  3. User-provided prompt_vars (highest priority)

Development

python -m pytest tests/ -v

License

MIT

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages