本文档介绍了 GitHub Actions 工作流,这些工作流支持 OpenHands 中自动化的问题解决和评估流程。该系统提供可重用的工作流,允许 OpenHands 仓库和外部仓库使用 AI 代理自动解决问题。
有关核心评估系统和基准测试基础设施的信息,请参阅 评估系统。有关构建和部署过程的详细信息,请参阅 构建系统。
GitHub Actions 集成提供三个主要功能:
该系统通过精心协调的工作流进行操作,这些工作流负责身份验证、环境设置、代理执行和结果报告。
来源:.github/workflows/openhands-resolver.yml1-434 openhands/resolver/examples/openhands-resolver.yml1-35
工作流使用复杂的条件逻辑来确定何时执行。主要条件包括:
| 触发类型 | 条件 | 权限检查 |
|---|---|---|
| 基于标签 | fix-me 或 fix-me-experimental 标签 | 无需额外参数 |
| 基于评论 | 包含 @openhands-agent 宏 | OWNER、COLLABORATOR 或 MEMBER |
| 基于审核 | 审核正文包含宏 | OWNER、COLLABORATOR 或 MEMBER |
来源:.github/workflows/openhands-resolver.yml69-85 .github/workflows/openhands-resolver.yml71-85
来源:.github/workflows/openhands-resolver.yml159-193 .github/workflows/openhands-resolver.yml244-252
该系统提供了一个可重用的工作流,外部仓库可以使用 workflow_call 触发器进行集成。
外部集成通过输入和 secret 支持全面的配置。
| 参数 | 类型 | 默认 | 描述 |
|---|---|---|---|
max_iterations | 数字 | 50 | 代理最大迭代次数 |
macro | 字符串 | "@openhands-agent" | 触发宏文本 |
target_branch | 字符串 | "main" | 拉取请求的目标分支 |
pr_type | 字符串 | "draft" | 要创建的拉取请求类型 |
LLM_MODEL | 字符串 | "anthropic/claude-sonnet-4-20250514" | 要使用的 LLM 模型 |
base_container_image | 字符串 | "" | 自定义沙箱环境 |
runner | 字符串 | "ubuntu-latest" | GitHub runner 类型 |
来源:openhands/resolver/examples/openhands-resolver.yml22-34 .github/workflows/openhands-resolver.yml5-40
来源:.github/workflows/openhands-resolver.yml243-260 .github/workflows/openhands-resolver.yml279-304
该工作流通过多种检测机制支持实验模式。
来源:.github/workflows/openhands-resolver.yml207-241
来源:.github/workflows/run-eval.yml1-57
工作流使用分层令牌系统,并带有回退机制。
| 标记类型 | 主要用途 | 回退 |
|---|---|---|
PAT_TOKEN | 仓库操作、拉取请求创建 | GITHUB_TOKEN |
GITHUB_TOKEN | 基本 API 访问 | 内置令牌 |
LLM_API_KEY | LLM 提供商身份验证 | 必填 |
SLACK_TOKEN | 通知服务 | 可选 |
工作流需要特定的 GitHub 权限。
来源:.github/workflows/openhands-resolver.yml64-67 .github/workflows/openhands-resolver.yml150-157
来源:.github/workflows/openhands-resolver.yml271-277 .github/workflows/openhands-resolver.yml307-341 .github/workflows/openhands-resolver.yml418-433