# =============================================================================
# Gitea 内置依赖更新(替代 Dependabot)
# =============================================================================
# 功能: 自动检查依赖更新,提 PR 到仓
# 频率: weekly
# 注: Gitea 1.19+ 支持此功能
# =============================================================================

version: 2

# -----------------------------------------------------------------------------
# 通用配置
# -----------------------------------------------------------------------------
# 限制单批 PR 数(防刷屏)
# 0 = 不限,实际建议 5-10
# 标签:让 reviewer 一眼看出"依赖更新"
labels:
  - "dependencies"
  - "auto-update"

# 自动合并 patch 级别更新
# minor / patch 都不自动,等 reviewer 评
# 如要开启,加: auto-merge: true

# -----------------------------------------------------------------------------
# Python 后端
# -----------------------------------------------------------------------------
updates:
  - package-ecosystem: "pip"
    directory: "/backend"
    schedule:
      interval: "weekly"
      day: "monday"
      time: "09:00"
      timezone: "Asia/Shanghai"
    open-pull-requests-limit: 5
    labels:
      - "dependencies"
      - "python"
      - "backend"
    # 忽略大版本(等人工)
    ignore:
      - dependency-name: "*"
        update-types: ["version-update:semver-major"]

  # -----------------------------------------------------------------------------
  # 前端 admin
  # -----------------------------------------------------------------------------
  - package-ecosystem: "npm"
    directory: "/frontend-admin"
    schedule:
      interval: "weekly"
      day: "monday"
      time: "09:00"
      timezone: "Asia/Shanghai"
    open-pull-requests-limit: 5
    labels:
      - "dependencies"
      - "frontend"
      - "admin"
    ignore:
      - dependency-name: "*"
        update-types: ["version-update:semver-major"]

  # -----------------------------------------------------------------------------
  # 前端 agent
  # -----------------------------------------------------------------------------
  - package-ecosystem: "npm"
    directory: "/frontend-agent"
    schedule:
      interval: "weekly"
      day: "monday"
      time: "09:00"
      timezone: "Asia/Shanghai"
    open-pull-requests-limit: 5
    labels:
      - "dependencies"
      - "frontend"
      - "agent"
    ignore:
      - dependency-name: "*"
        update-types: ["version-update:semver-major"]

  # -----------------------------------------------------------------------------
  # 前端 h5
  # -----------------------------------------------------------------------------
  - package-ecosystem: "npm"
    directory: "/frontend-h5"
    schedule:
      interval: "weekly"
      day: "monday"
      time: "09:00"
      timezone: "Asia/Shanghai"
    open-pull-requests-limit: 5
    labels:
      - "dependencies"
      - "frontend"
      - "h5"
    ignore:
      - dependency-name: "*"
        update-types: ["version-update:semver-major"]

  # -----------------------------------------------------------------------------
  # 前端 portal
  # -----------------------------------------------------------------------------
  - package-ecosystem: "npm"
    directory: "/frontend-portal"
    schedule:
      interval: "weekly"
      day: "monday"
      time: "09:00"
      timezone: "Asia/Shanghai"
    open-pull-requests-limit: 5
    labels:
      - "dependencies"
      - "frontend"
      - "portal"
    ignore:
      - dependency-name: "*"
        update-types: ["version-update:semver-major"]

  # -----------------------------------------------------------------------------
  # Docker 基础镜像
  # -----------------------------------------------------------------------------
  - package-ecosystem: "docker"
    directory: "/backend"
    schedule:
      interval: "weekly"
      day: "monday"
      time: "09:00"
      timezone: "Asia/Shanghai"
    open-pull-requests-limit: 3
    labels:
      - "dependencies"
      - "docker"
      - "backend"

  - package-ecosystem: "docker"
    directory: "/frontend-admin"
    schedule:
      interval: "weekly"
      day: "monday"
      time: "09:00"
      timezone: "Asia/Shanghai"
    open-pull-requests-limit: 3
    labels:
      - "dependencies"
      - "docker"
      - "frontend"

  - package-ecosystem: "docker"
    directory: "/frontend-agent"
    schedule:
      interval: "weekly"
      day: "monday"
      time: "09:00"
      timezone: "Asia/Shanghai"
    open-pull-requests-limit: 3
    labels:
      - "dependencies"
      - "docker"
      - "frontend"

  - package-ecosystem: "docker"
    directory: "/frontend-h5"
    schedule:
      interval: "weekly"
      day: "monday"
      time: "09:00"
      timezone: "Asia/Shanghai"
    open-pull-requests-limit: 3
    labels:
      - "dependencies"
      - "docker"
      - "frontend"

  - package-ecosystem: "docker"
    directory: "/frontend-portal"
    schedule:
      interval: "weekly"
      day: "monday"
      time: "09:00"
      timezone: "Asia/Shanghai"
    open-pull-requests-limit: 3
    labels:
      - "dependencies"
      - "docker"
      - "frontend"

  # -----------------------------------------------------------------------------
  # GitHub Actions / Gitea Actions(如有)
  # -----------------------------------------------------------------------------
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "weekly"
      day: "monday"
      time: "09:00"
      timezone: "Asia/Shanghai"
    open-pull-requests-limit: 3
    labels:
      - "dependencies"
      - "ci"
