diff --git a/.github/workflows/community-stats.yml b/.github/workflows/community-stats.yml index 37828cd..1cf1ca1 100644 --- a/.github/workflows/community-stats.yml +++ b/.github/workflows/community-stats.yml @@ -1,5 +1,5 @@ # OpenWebUI 社区统计报告自动生成 -# 使用 GitHub Gist 存储动态徽章数据,避免频繁 commit +# 使用 GitHub Gist 存储动态徽章数据,完全不 commit 到主仓库 name: Community Stats @@ -10,9 +10,6 @@ on: # 手动触发 workflow_dispatch: -permissions: - contents: write - jobs: update-stats: runs-on: ubuntu-latest @@ -20,8 +17,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - name: Set up Python uses: actions/setup-python@v5 @@ -40,57 +35,44 @@ jobs: python scripts/openwebui_stats.py - name: Upload badges to Gist - if: ${{ secrets.GIST_TOKEN != '' && secrets.GIST_ID != '' }} env: GIST_TOKEN: ${{ secrets.GIST_TOKEN }} GIST_ID: ${{ secrets.GIST_ID }} run: | - # Upload each badge JSON to Gist + if [ -z "$GIST_TOKEN" ] || [ -z "$GIST_ID" ]; then + echo "⚠️ GIST_TOKEN or GIST_ID not set, skipping Gist upload" + exit 0 + fi + + echo "📤 Uploading badges to Gist..." + + # Build JSON payload with all badge files + files_json="{" + first=true for badge in docs/badges/*.json; do filename=$(basename "$badge") - content=$(cat "$badge" | jq -c '.') + content=$(cat "$badge" | sed 's/"/\\"/g' | tr -d '\n') - # Update Gist file - curl -s -X PATCH \ - -H "Authorization: token $GIST_TOKEN" \ - -H "Accept: application/vnd.github+json" \ - "https://api.github.com/gists/$GIST_ID" \ - -d "{\"files\":{\"$filename\":{\"content\":$content}}}" - - echo "✅ Uploaded $filename to Gist" + if [ "$first" = true ]; then + first=false + else + files_json+="," + fi + files_json+="\"$filename\":{\"content\":\"$content\"}" done - - - name: Check for significant changes - id: check_changes - run: | - # Only commit if there are changes to markdown files (not just time updates) - # This reduces commit frequency by only committing when actual data changes + files_json+="}" - # Get current stats - NEW_DOWNLOADS=$(jq -r '.total_downloads' docs/community-stats.json 2>/dev/null || echo "0") - NEW_POSTS=$(jq -r '.total_posts' docs/community-stats.json 2>/dev/null || echo "0") + # Update Gist with all files at once + response=$(curl -s -X PATCH \ + -H "Authorization: token $GIST_TOKEN" \ + -H "Accept: application/vnd.github+json" \ + "https://api.github.com/gists/$GIST_ID" \ + -d "{\"files\":$files_json}") - # Get previous stats from git - OLD_DOWNLOADS=$(git show HEAD:docs/community-stats.json 2>/dev/null | jq -r '.total_downloads' 2>/dev/null || echo "0") - OLD_POSTS=$(git show HEAD:docs/community-stats.json 2>/dev/null | jq -r '.total_posts' 2>/dev/null || echo "0") - - echo "Previous: $OLD_DOWNLOADS downloads, $OLD_POSTS posts" - echo "Current: $NEW_DOWNLOADS downloads, $NEW_POSTS posts" - - # Only mark as changed if downloads or posts count changed - if [ "$NEW_DOWNLOADS" != "$OLD_DOWNLOADS" ] || [ "$NEW_POSTS" != "$OLD_POSTS" ]; then - echo "changed=true" >> $GITHUB_OUTPUT - echo "📊 Stats changed, will commit" + if echo "$response" | grep -q '"id"'; then + echo "✅ Successfully updated Gist: https://gist.github.com/$GIST_ID" else - echo "changed=false" >> $GITHUB_OUTPUT - echo "⏭️ No significant changes, skipping commit" + echo "❌ Failed to update Gist" + echo "$response" + exit 1 fi - - - name: Commit and push changes - if: steps.check_changes.outputs.changed == 'true' - run: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git add docs/community-stats.zh.md docs/community-stats.md docs/community-stats.json README.md README_CN.md - git commit -m "chore: update community stats $(date +'%Y-%m-%d')" - git push diff --git a/README.md b/README.md index 0744318..09ea956 100644 --- a/README.md +++ b/README.md @@ -7,28 +7,12 @@ A collection of enhancements, plugins, and prompts for [OpenWebUI](https://githu ## 📊 Community Stats -> 🕐 Auto-updated: 2026-01-08 22:10 +[![Plugins](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/7beb87fdc36bf10408282b1db495fe55/raw/plugins.json&style=for-the-badge)](https://openwebui.com/u/Fu-Jie) +[![Downloads](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/7beb87fdc36bf10408282b1db495fe55/raw/downloads.json&style=for-the-badge)](https://openwebui.com/u/Fu-Jie) +[![Upvotes](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/7beb87fdc36bf10408282b1db495fe55/raw/upvotes.json&style=for-the-badge)](https://openwebui.com/u/Fu-Jie) +[![Followers](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/7beb87fdc36bf10408282b1db495fe55/raw/followers.json&style=for-the-badge)](https://openwebui.com/u/Fu-Jie) -| 👤 Author | 👥 Followers | ⭐ Points | 🏆 Contributions | -|:---:|:---:|:---:|:---:| -| [Fu-Jie](https://openwebui.com/u/Fu-Jie) | **54** | **68** | **20** | - -| 📝 Posts | ⬇️ Downloads | 👁️ Views | 👍 Upvotes | 💾 Saves | -|:---:|:---:|:---:|:---:|:---:| -| **13** | **960** | **10140** | **60** | **52** | - -### 🔥 Top 6 Popular Plugins - -| Rank | Plugin | Downloads | Views | -|:---:|------|:---:|:---:| -| 🥇 | [Smart Mind Map](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | 304 | 2659 | -| 🥈 | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | 179 | 522 | -| 🥉 | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | 121 | 1329 | -| 4️⃣ | [📊 Smart Infographic (AntV)](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | 94 | 1183 | -| 5️⃣ | [Flash Card](https://openwebui.com/posts/flash_card_65a2ea8f) | 89 | 1612 | -| 6️⃣ | [Export to Word (Enhanced)](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | 75 | 689 | - -*See full stats in [Community Stats Report](./docs/community-stats.md)* +> 📈 *Stats auto-updated hourly • [View Full Report](./docs/community-stats.md) • [My Profile](https://openwebui.com/u/Fu-Jie)* ## 📦 Project Contents diff --git a/README_CN.md b/README_CN.md index ecfcc0f..c5ac4ed 100644 --- a/README_CN.md +++ b/README_CN.md @@ -7,28 +7,12 @@ OpenWebUI 增强功能集合。包含个人开发与收集的插件、提示词 ## 📊 社区统计 -> 🕐 自动更新于 2026-01-08 22:10 +[![Plugins](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/7beb87fdc36bf10408282b1db495fe55/raw/plugins.json&style=for-the-badge&label=插件)](https://openwebui.com/u/Fu-Jie) +[![Downloads](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/7beb87fdc36bf10408282b1db495fe55/raw/downloads.json&style=for-the-badge&label=下载)](https://openwebui.com/u/Fu-Jie) +[![Upvotes](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/7beb87fdc36bf10408282b1db495fe55/raw/upvotes.json&style=for-the-badge&label=点赞)](https://openwebui.com/u/Fu-Jie) +[![Followers](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Fu-Jie/7beb87fdc36bf10408282b1db495fe55/raw/followers.json&style=for-the-badge&label=粉丝)](https://openwebui.com/u/Fu-Jie) -| 👤 作者 | 👥 粉丝 | ⭐ 积分 | 🏆 贡献 | -|:---:|:---:|:---:|:---:| -| [Fu-Jie](https://openwebui.com/u/Fu-Jie) | **54** | **68** | **20** | - -| 📝 发布 | ⬇️ 下载 | 👁️ 浏览 | 👍 点赞 | 💾 收藏 | -|:---:|:---:|:---:|:---:|:---:| -| **13** | **960** | **10140** | **60** | **52** | - -### 🔥 热门插件 Top 6 - -| 排名 | 插件 | 下载 | 浏览 | -|:---:|------|:---:|:---:| -| 🥇 | [Smart Mind Map](https://openwebui.com/posts/turn_any_text_into_beautiful_mind_maps_3094c59a) | 304 | 2659 | -| 🥈 | [Export to Excel](https://openwebui.com/posts/export_mulit_table_to_excel_244b8f9d) | 179 | 522 | -| 🥉 | [Async Context Compression](https://openwebui.com/posts/async_context_compression_b1655bc8) | 121 | 1329 | -| 4️⃣ | [📊 Smart Infographic (AntV)](https://openwebui.com/posts/smart_infographic_ad6f0c7f) | 94 | 1183 | -| 5️⃣ | [Flash Card](https://openwebui.com/posts/flash_card_65a2ea8f) | 89 | 1612 | -| 6️⃣ | [Export to Word (Enhanced)](https://openwebui.com/posts/export_to_word_enhanced_formatting_fca6a315) | 75 | 689 | - -*完整统计请查看 [社区统计报告](./docs/community-stats.zh.md)* +> 📈 *每小时自动更新 • [查看完整报告](./docs/community-stats.zh.md) • [我的主页](https://openwebui.com/u/Fu-Jie)* ## 📦 项目内容