automate-github-issues

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Automate GitHub Issues with Jules

用Jules自动化处理GitHub Issues

You are setting up a repository to automatically analyze open GitHub issues, plan implementation tasks, and dispatch parallel Jules coding agents to fix them.
你将搭建一个仓库,用于自动分析开放的GitHub issues、规划实现任务,并调度并行的Jules编码代理来修复这些问题。

What You're Setting Up

你要搭建的内容

A 5-phase automated pipeline that runs via GitHub Actions (or locally):
  1. Analyze — Fetch open issues and format as structured markdown
  2. Plan — A Jules session performs deep code-level triage and produces self-contained task prompts
  3. Validate — Verify no two tasks modify the same file (prevents merge conflicts)
  4. Dispatch — Spawn parallel Jules sessions, one per task
  5. Merge — Sequential PR merge with CI validation
一个通过GitHub Actions(或本地运行)执行的5阶段自动化流水线:
  1. 分析 — 获取开放的issues并格式化为结构化markdown
  2. 规划 — 一个Jules会话执行深度代码级分类,并生成独立的任务提示词
  3. 验证 — 验证没有两个任务修改同一文件(防止合并冲突)
  4. 调度 — 生成并行的Jules会话,每个任务对应一个会话
  5. 合并 — 带CI验证的顺序PR合并

Setup Steps

搭建步骤

Step 1: Copy fleet scripts to the repository

步骤1:将集群脚本复制到仓库中

Copy the entire
scripts/
directory from this skill into the target repository at
scripts/fleet/
:
Target structure:
scripts/fleet/
├── fleet-analyze.ts
├── fleet-plan.ts
├── fleet-dispatch.ts
├── fleet-merge.ts
├── types.ts
├── prompts/
│   ├── analyze-issues.ts
│   └── bootstrap.ts
└── github/
    ├── git.ts
    ├── issues.ts
    ├── markdown.ts
    └── cache-plugin.ts
Important: Preserve the directory structure exactly. The scripts use relative imports between files.
将本技能中的整个
scripts/
目录复制到目标仓库的
scripts/fleet/
路径下:
Target structure:
scripts/fleet/
├── fleet-analyze.ts
├── fleet-plan.ts
├── fleet-dispatch.ts
├── fleet-merge.ts
├── types.ts
├── prompts/
│   ├── analyze-issues.ts
│   └── bootstrap.ts
└── github/
    ├── git.ts
    ├── issues.ts
    ├── markdown.ts
    └── cache-plugin.ts
重要提示: 严格保留目录结构。脚本之间使用相对导入。

Step 2: Copy workflow templates

步骤2:复制工作流模板

Copy the workflow files from
assets/
to the repository's
.github/workflows/
directory:
  • assets/fleet-dispatch.yml
    .github/workflows/fleet-dispatch.yml
  • assets/fleet-merge.yml
    .github/workflows/fleet-merge.yml
assets/
中的工作流文件复制到仓库的
.github/workflows/
目录下:
  • assets/fleet-dispatch.yml
    .github/workflows/fleet-dispatch.yml
  • assets/fleet-merge.yml
    .github/workflows/fleet-merge.yml

Step 3: Create a package.json for the fleet scripts

步骤3:为集群脚本创建package.json

Create
scripts/fleet/package.json
with the required dependencies:
json
{
  "name": "fleet-scripts",
  "private": true,
  "type": "module",
  "dependencies": {
    "@google/jules-sdk": "^0.1.0",
    "octokit": "^4.1.0",
    "find-up": "^7.0.0"
  },
  "devDependencies": {
    "@types/bun": "^1.2.0"
  }
}
创建
scripts/fleet/package.json
,包含所需依赖:
json
{
  "name": "fleet-scripts",
  "private": true,
  "type": "module",
  "dependencies": {
    "@google/jules-sdk": "^0.1.0",
    "octokit": "^4.1.0",
    "find-up": "^7.0.0"
  },
  "devDependencies": {
    "@types/bun": "^1.2.0"
  }
}

Step 4: Create environment template

步骤4:创建环境变量模板

Copy
assets/.env.example
to the repository root.
assets/.env.example
复制到仓库根目录。

Step 5: Install dependencies

步骤5:安装依赖

bash
cd scripts/fleet && bun install
bash
cd scripts/fleet && bun install

Step 6: Print next steps for the user

步骤6:为用户打印后续步骤

Tell the user they need to:
  1. Add
    JULES_API_KEY
    as a GitHub repository secret (Settings → Secrets → Actions)
  2. GITHUB_TOKEN
    is provided automatically by GitHub Actions
  3. Customize the cron schedule in
    .github/workflows/fleet-dispatch.yml
    (default: daily 6am UTC)
  4. Commit all generated files
告知用户需要完成以下操作:
  1. JULES_API_KEY
    添加为GitHub仓库密钥(设置 → 密钥 → Actions)
  2. GITHUB_TOKEN
    由GitHub Actions自动提供
  3. 自定义
    .github/workflows/fleet-dispatch.yml
    中的cron调度(默认:UTC时间每日早6点)
  4. 提交所有生成的文件

Manual Usage

手动使用

After setup, the user can run the pipeline locally:
bash
cd scripts/fleet
搭建完成后,用户可以在本地运行流水线:
bash
cd scripts/fleet

Fetch open issues

获取开放的issues

bun fleet-analyze.ts
bun fleet-analyze.ts

Plan tasks (creates a Jules planning session)

规划任务(创建一个Jules规划会话)

JULES_API_KEY=<key> bun fleet-plan.ts
JULES_API_KEY=<key> bun fleet-plan.ts

Dispatch parallel agents

调度并行代理

JULES_API_KEY=<key> bun fleet-dispatch.ts
JULES_API_KEY=<key> bun fleet-dispatch.ts

Merge PRs sequentially

顺序合并PRs

GITHUB_TOKEN=<token> bun fleet-merge.ts
undefined
GITHUB_TOKEN=<token> bun fleet-merge.ts
undefined

Customization

自定义

Prompt Tuning

提示词调优

The analysis prompt in
scripts/fleet/prompts/analyze-issues.ts
controls how deeply issues are investigated. Users can adjust:
  • Root cause analysis depth
  • Solution implementation detail level
  • Merge conflict avoidance rules
  • File ownership constraints
scripts/fleet/prompts/analyze-issues.ts
中的分析提示词控制问题的调查深度。用户可以调整:
  • 根本原因分析深度
  • 解决方案实现细节级别
  • 合并冲突避免规则
  • 文件所有权约束

Issue Filtering

问题过滤

Edit
scripts/fleet/github/issues.ts
to filter issues by label, milestone, or state.
编辑
scripts/fleet/github/issues.ts
,可按标签、里程碑或状态过滤issues。

Resource References

资源参考

  • Architecture Overview — Detailed explanation of the 5-phase pipeline
  • Architecture Overview — 5阶段流水线的详细说明

Troubleshooting

故障排除

  • "Unable to parse git remote URL": Ensure the repo has a valid GitHub remote (
    git remote get-url origin
    )
  • Ownership conflict errors: Two tasks claim the same file. Adjust the task JSON or merge them manually.
  • CI timeout during merge: Increase
    maxWaitMs
    in
    fleet-merge.ts
    (default: 10 minutes)
  • Bun not found: Install Bun:
    curl -fsSL https://bun.sh/install | bash
  • "无法解析git远程URL":确保仓库有有效的GitHub远程地址(
    git remote get-url origin
  • 所有权冲突错误:两个任务修改同一文件。调整任务JSON或手动合并它们。
  • 合并时CI超时:增加
    fleet-merge.ts
    中的
    maxWaitMs
    (默认:10分钟)
  • 未找到Bun:安装Bun:
    curl -fsSL https://bun.sh/install | bash