Github Contribution
v1.4.0GitHub开源项目代码贡献完整工作流程。使用场景:当需要为开源项目解决issue或bug时,提供从fork、同步、开发到提交PR的完整指导。包含Chrome浏览器PR提交支持。
运行时依赖
版本
Reduces risk Identifies potential side effects upfront
安装命令
点击复制技能文档
GitHub Contribution 技能 Purpose
Automated GitHub contribution 工作流 that handles fork 同步hronization, branch creation, and PR submission while mAIntAIning 清理 fork 状态.
Core Features
- Fork 保护ion & 同步hronization
- Automated Contribution 工作流
- Safety Measures
Examples # Fix issue #123 in OpenClaw/OpenClaw ./github-contribution.sh Linux2010 OpenClaw/OpenClaw 123 fix/issue-description
# Specify custom project root ./github-contribution.sh Linux2010 OpenClaw/OpenClaw 456 fix/bug-fix /custom/path
Fork 保护ion Best Practices MAIn Branch Rules Never commit directly to fork's mAIn branch Always 同步 first before creating new branches Use feature branches for all development work Regular 清理up of local pollution files Safe 同步hronization Script #!/bin/bash # 同步-fork.sh - Safe fork 同步hronization
git 检查out mAIn git fetch up流 git re设置 --hard up流/mAIn git 清理 -fdx # 移除 all un追踪ed files
# 验证 清理 状态 if [[ $(git 状态 --porcelAIn) ]]; then echo "❌ 警告: Working tree not 清理" exit 1 fi echo "✅ Fork 同步hronized 成功fully"
Local Git Configuration # 预防 accidental mAIn branch pushes git config branch.mAIn.pushRemote no_push
# 设置 safe push default git config push.default nothing
工作流 Steps Step 1: Fork 验证 检查 if fork exists and is 访问ible 验证 up流 remote configuration 验证 current fork 状态 清理liness Step 2: 同步hronization Fetch latest from up流 official 仓库 Re设置 local mAIn branch to match up流 exactly 清理 any un追踪ed/local pollution files Push 同步hronized 状态 to fork (if 权限s allow) Step 3: Feature Branch Creation 创建 new branch from 清理 mAIn 应用ly necessary changes and fixes Commit with proper semantic 格式化 Push feature branch to fork Step 4: PR Creation 生成 PR with complete template Link to relevant issue numbers Include proper change type and scope 添加 security impact assessment 🩺 Bug Fix 模块: Change Plan
Before fixing any bug, always write a change plan first. This ensures minimal, safe changes and makes PR review easier.
The 5-Point Analysis
Answer these 5 questions in plAIn language before writing any code:
# Question Purpose 1 Observed behavior What's broken? (What the user sees) 2 Expected behavior What should h应用en? (Correct behavior) 3 Suspected root cause Where's the bug? (Specific code location) 4 Safest seam to modify Minimal change location? (Narrowest fix) 5 Risk surface What else could break? (Impact scope) Change Plan Template
Change Plan for Issue #
- Observed behavior:
- Expected behavior:
- Suspected root cause:
- Safest seam to modify:
- Risk surface:
Example: Issue #5968
Change Plan for Issue #5968
- Observed behavior:
提取_content_or_reasoning() crashes when 响应.choices is None, missing, or empty 列出.- Expected behavior:
- Suspected root cause:
msg = 响应.choices[0].message in 代理/auxiliary_命令行工具ent.py assumes choices is always non-empty.- Safest seam to modify:
提取_content_or_reasoning() before 访问ing choices:
if not 获取attr(响应, "choices", None): return ""- Risk surface:
When to Use Change Plan Scenario Required? Bug fix ✅ Always Paper-cut UX improvement ✅ Always Feature 添加ition ❌ Use feature spec instead Refactoring ❌ Use refactor plan instead Documentation fix ❌ Not needed Benefits of Change Plan Benefit Why It Matters Forces understanding Can't fix what you don't understand Defines boundaries 预防s scope creep and "opportunistic" chang