feat: use dynamic badges for plugin versions, remove version changes as commit trigger

This commit is contained in:
fujie
2026-02-11 13:28:19 +08:00
parent 2ac8d4b14f
commit fa5d962152
2 changed files with 17 additions and 12 deletions

View File

@@ -95,12 +95,7 @@ jobs:
echo "📦 New plugin detected: $OLD_POSTS -> $NEW_POSTS"
fi
# 检查版本变更
if [ "$OLD_VERSIONS" != "$NEW_VERSIONS" ]; then
SHOULD_COMMIT="true"
CHANGE_REASON="${CHANGE_REASON:+$CHANGE_REASON, }plugin version updated"
echo "🔄 Plugin version changed"
fi

View File

@@ -812,6 +812,19 @@ class OpenWebUIStats:
}
)
}
# 版本号徽章
ver = post.get("version", "N/A") or "N/A"
ver_color = "blue" if post.get("version") else "gray"
files_payload[f"badge_p{idx}_version.json"] = {
"content": json.dumps(
{
"schemaVersion": 1,
"label": "v",
"message": ver,
"color": ver_color,
}
)
}
# 生成所有帖子的个体徽章 (用于详细报表)
# 生成所有帖子的个体徽章 (用于详细报表)
@@ -834,7 +847,6 @@ class OpenWebUIStats:
}
)
}
# 2. Views
files_payload[f"badge_post_{slug_hash}_vw.json"] = {
"content": json.dumps(
@@ -1040,11 +1052,9 @@ class OpenWebUIStats:
dl_cell = self.get_badge(f"p{idx}_dl", stats, user, delta, is_post=True)
vw_cell = self.get_badge(f"p{idx}_vw", stats, user, delta, is_post=True)
# 版本号使用态 Shields.io 徽章
ver = post["version"] if post["version"] else "N/A"
ver_color = "blue" if post["version"] else "gray"
ver_badge = (
f"![v](https://img.shields.io/badge/v-{ver}-{ver_color}?style=flat)"
# 版本号使用态 Shields.io 徽章
ver_badge = self.get_badge(
f"p{idx}_version", stats, user, delta, is_post=True
)
# 更新时间使用静态 Shields.io 徽章