stages:
  - auto-update

auto-update:
  # 需要配置 REPO_TOKEN 和 THE_REPO
  stage: auto-update
  image: python:3.11
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule" # 通过定时任务触发
  before_script:
    # 创建 pip 配置目录并写入阿里云镜像配置
    - mkdir -p ~/.pip
    - echo "[global]" > ~/.pip/pip.conf
    - echo "index-url = https://mirrors.aliyun.com/pypi/simple/" >> ~/.pip/pip.conf
    - echo "trusted-host = mirrors.aliyun.com" >> ~/.pip/pip.conf
  script:
    # 安装 PyYAML 和 Requests
    - pip install -r requirements.txt
    # 运行更新脚本
    - python update_files.py
