← 返回
未分类 中文

GitHub操作助手

GitHub操作助手 - PR/Issue/代码搜索/仓库管理,基于gh CLI。v2新增:CI状态监控、Release管理、Code Review辅助
GitHub操作助手 - PR/Issue/代码搜索/仓库管理,基于gh CLI。v2新增:CI状态监控、Release管理、Code Review辅助
534422530
未分类 clawhub v2.0.0 1 版本 99428.6 Key: 无需
★ 0
Stars
📥 174
下载
💾 0
安装
1
版本
#devops#git#github#issue#latest#pr#repository

概述

GitHub Helper - GitHub操作助手

> 激活词: GitHub / PR操作 / Issue管理

功能

  • PR创建和管理
  • Issue操作
  • 仓库浏览
  • 代码搜索
  • 代码审查

安装

# Windows
winget install gh

# 登录
gh auth login

命令参考

PR操作

# 创建PR
gh pr create --title "标题" --body "描述"

# 查看PR列表
gh pr list --state open

# PR详情
gh pr view 123

# 合并PR
gh pr merge 123 --squash

# 评论PR
gh pr comment 123 --body "评论内容"

Issue操作

# 创建Issue
gh issue create --title "标题" --body "描述"

# 查看Issue列表
gh issue list --state open

# 关闭Issue
gh issue close 456

仓库操作

# 查看仓库
gh repo view

# 克隆仓库
gh repo clone owner/repo

# 查看代码
gh search code "keyword"

Python封装

import subprocess

class GitHubHelper:
    def __init__(self, repo: str = None):
        self.repo = repo
    
    def create_pr(self, title: str, body: str = "") -> str:
        result = subprocess.run(
            ["gh", "pr", "create", "--title", title, "--body", body],
            capture_output=True, text=True
        )
        return result.stdout.strip()
    
    def list_prs(self, state: str = "open") -> list:
        result = subprocess.run(
            ["gh", "pr", "list", "--state", state, "--json", "number,title,state"],
            capture_output=True, text=True
        )
        import json
        return json.loads(result.stdout)
    
    def create_issue(self, title: str, body: str = "") -> str:
        result = subprocess.run(
            ["gh", "issue", "create", "--title", title, "--body", body],
            capture_output=True, text=True
        )
        return result.stdout.strip()
    
    def search_code(self, query: str, repo: str = None) -> list:
        cmd = ["gh", "search", "code", query, "--json", "path,repository"]
        if repo:
            cmd.extend(["--repo", repo])
        result = subprocess.run(cmd, capture_output=True, text=True)
        import json
        return json.loads(result.stdout)

使用场景

  1. 自动化PR审查流程
  2. 批量Issue管理
  3. 代码搜索分析
  4. 仓库状态监控

版本历史

共 1 个版本

  • v2.0.0 当前
    2026-05-29 21:32 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Contract Review Skill

534422530
利用AI技术审查合同,识别风险条款、缺失条款及合规问题,助您做出明智决策。
★ 0 📥 433

Laosi Mcp Security Audit

534422530
对MCP服务器执行全面的安全审计,包括漏洞扫描、恶意软件检测、合规性检查和详细的修复报告。
★ 0 📥 453

Karpathy编程四大原则

534422530
AI编程四大原则 —— 源自 Karpathy 法则 (forrestchang/andrej-karpathy-skills94.2k⭐)。在AI编程时强制执行四大原则:先思考、保持简单、精准修改、目标驱动。适用于代码审查、代码生成、bu
★ 3 📥 865