Skip to content

Commit 188bd5e

Browse files
committed
update to latest codes
1 parent 3afa499 commit 188bd5e

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed

.github-task-workflow-diagnosis.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# GitHub Task Workflow 问题诊断报告
2+
3+
## 发现的问题
4+
5+
### 1. ✅ 已修复:SSL 证书验证失败 (主要问题)
6+
7+
**症状:**
8+
```
9+
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
10+
```
11+
12+
**原因:**
13+
- Python 3.14.0b1 来自 ServBay (`/Applications/ServBay/script/alias/python3`)
14+
- ServBay 的 Python 使用独立的 OpenSSL,证书路径配置不正确
15+
- Python 无法找到系统的 CA 证书
16+
17+
**修复方案:**
18+
`create_issue.py``update_issue.py` 中添加 SSL 上下文修复:
19+
```python
20+
import ssl
21+
import certifi
22+
ssl._create_default_https_context = lambda: ssl.create_default_context(cafile=certifi.where())
23+
```
24+
25+
**状态:** ✅ 已应用到 `../spark-skills/github-task-workflow/scripts/` 目录下的脚本
26+
27+
---
28+
29+
### 2. ✅ 已修复:Git Hooks 未安装
30+
31+
**症状:**
32+
- `.git/hooks/` 目录缺少 `prepare-commit-msg``post-commit`
33+
- 提交时不会自动追加 `Refs: #issue` 到提交信息
34+
- 提交后不会自动评论到 GitHub Issue
35+
36+
**修复方案:**
37+
已安装以下 hooks:
38+
- `.git/hooks/prepare-commit-msg` - 自动追加 issue 引用到提交信息
39+
- `.git/hooks/post-commit` - 自动向 GitHub Issue 添加提交评论
40+
41+
---
42+
43+
### 3. ⚠️ 需要用户处理:GitHub Token 权限不足
44+
45+
**症状:**
46+
```
47+
Error: GitHub API error: 403 - {"message":"Resource not accessible by personal access token"}
48+
```
49+
50+
**原因:**
51+
当前的 `GITHUB_TOKEN` 环境变量没有 `repo` scope 权限,无法创建/更新 issue。
52+
53+
**解决方案:**
54+
1. 访问 https://github.com/settings/tokens
55+
2. 创建新的 Personal Access Token (classic)
56+
3. 勾选以下权限:
57+
- `repo` - 完全控制仓库(包括创建 issue)
58+
4. 更新环境变量:
59+
```bash
60+
export GITHUB_TOKEN="ghp_your_new_token_here"
61+
```
62+
63+
---
64+
65+
## 验证测试
66+
67+
运行以下命令验证修复:
68+
69+
```bash
70+
# 测试 SSL 修复(应该返回 403,而不是 SSL 错误)
71+
cd /Users/patrick/innate/spark-cli
72+
python3 ../spark-skills/github-task-workflow/scripts/create_issue.py \
73+
--title "Test" --body "Test" 2>&1
74+
75+
# 如果看到 "Error: GitHub API error: 403",说明 SSL 已修复
76+
# 如果是 "SSL: CERTIFICATE_VERIFY_FAILED",说明修复未生效
77+
```
78+
79+
---
80+
81+
## 完整使用流程
82+
83+
### 1. 设置 GitHub Token
84+
```bash
85+
export GITHUB_TOKEN="ghp_your_token_here"
86+
```
87+
88+
### 2. 创建 Issue 并执行工作流
89+
```bash
90+
# 方法 A: 使用编排器
91+
python3 ../spark-skills/github-task-workflow/scripts/orchestrate.py init tasks/my-task.md
92+
93+
# 执行代码修改...
94+
95+
python3 ../spark-skills/github-task-workflow/scripts/orchestrate.py finish
96+
```
97+
98+
### 3. 分支命名约定
99+
创建分支时以 issue 编号开头:
100+
```bash
101+
git checkout -b 11-feature-name # 11 是 issue 编号
102+
```
103+
104+
这样 hooks 会自动追加 `Refs: #11` 到提交信息,并自动评论到 issue。
105+
106+
---
107+
108+
## 文件变更
109+
110+
### 修改的文件
111+
1. `../spark-skills/github-task-workflow/scripts/create_issue.py` - 添加 SSL 修复
112+
2. `../spark-skills/github-task-workflow/scripts/update_issue.py` - 添加 SSL 修复
113+
3. `.git/hooks/prepare-commit-msg` - 新安装
114+
4. `.git/hooks/post-commit` - 新安装
115+
116+
### 配置状态
117+
- `.github-task-workflow.yaml` - 已配置(repo: variableway/spark-cli)
118+
- `.github-task-workflow.active-issue` - 包含 issue #11(可能已过期)
119+
120+
---
121+
122+
## 建议
123+
124+
1. **更新 GITHUB_TOKEN**:获取一个有 `repo` 权限的 token
125+
2. **清理 active-issue**:如果 #11 已完成,删除 `.github-task-workflow.active-issue`
126+
3. **测试工作流**:创建一个新任务文件测试完整流程

0 commit comments

Comments
 (0)