51 lines
1.3 KiB
YAML
51 lines
1.3 KiB
YAML
# OpenWebUI 社区统计报告自动生成
|
||
# 只在统计数据变化时 commit,避免频繁提交
|
||
|
||
name: Community Stats
|
||
|
||
on:
|
||
# 每小时整点运行
|
||
schedule:
|
||
- cron: '0 * * * *'
|
||
# 手动触发
|
||
workflow_dispatch:
|
||
|
||
permissions:
|
||
contents: write
|
||
|
||
jobs:
|
||
update-stats:
|
||
runs-on: ubuntu-latest
|
||
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@v4
|
||
with:
|
||
token: ${{ secrets.GITHUB_TOKEN }}
|
||
|
||
- name: Set up Python
|
||
uses: actions/setup-python@v5
|
||
with:
|
||
python-version: '3.11'
|
||
|
||
- name: Install dependencies
|
||
run: |
|
||
pip install requests python-dotenv
|
||
|
||
|
||
|
||
- name: Generate stats report
|
||
env:
|
||
OPENWEBUI_API_KEY: ${{ secrets.OPENWEBUI_API_KEY }}
|
||
OPENWEBUI_USER_ID: ${{ secrets.OPENWEBUI_USER_ID }}
|
||
run: |
|
||
python scripts/openwebui_stats.py
|
||
|
||
- name: Commit and push changes
|
||
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 diff --staged --quiet || git commit -m "chore: update community stats $(date +'%Y-%m-%d')"
|
||
git push
|