fix(mcp): get_ci_status 兼容 Gitea 1.22 的 status 字段(非 state)
This commit is contained in:
parent
14fe02ec7d
commit
dccca234b5
@ -762,7 +762,10 @@ pub fn gitea_api_get_ci_status(project_id: &str, commit_sha: &str) -> Result<Str
|
|||||||
let mut lines = vec![format!("## CI 状态:commit `{}`\n", short_sha)];
|
let mut lines = vec![format!("## CI 状态:commit `{}`\n", short_sha)];
|
||||||
let mut all_pass = true;
|
let mut all_pass = true;
|
||||||
for (ctx, s) in &latest {
|
for (ctx, s) in &latest {
|
||||||
let state = s["state"].as_str().unwrap_or("unknown");
|
// Gitea 1.22 Actions 使用 "status" 字段;传统 commit status API 用 "state"
|
||||||
|
let state = s["status"].as_str()
|
||||||
|
.or_else(|| s["state"].as_str())
|
||||||
|
.unwrap_or("unknown");
|
||||||
let desc = s["description"].as_str().unwrap_or("");
|
let desc = s["description"].as_str().unwrap_or("");
|
||||||
let icon = match state {
|
let icon = match state {
|
||||||
"success" => "✅",
|
"success" => "✅",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user