Skip to content

Weekly Update Providers #43

Weekly Update Providers

Weekly Update Providers #43

name: Weekly Update Providers
on:
schedule:
- cron: '0 0 * * 1' # 每周一 00:00 UTC
workflow_dispatch: # 手动触发也可以
permissions:
contents: write
pull-requests: write
jobs:
update-providers:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: true
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: install dependencies
run: pnpm install
- name: Run updateProviders script
run: pnpm tsx scripts/updateProvidersModels.js
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
SILICONFLOW_API_KEY: ${{ secrets.SILICONFLOW_API_KEY }}
- name: Check for changes
id: git-check
run: |
if [ -n "$(git status --porcelain shared/providers.ts)" ]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
echo "发现文件变更"
else
echo "has_changes=false" >> $GITHUB_OUTPUT
echo "没有文件变更,跳过 PR 创建"
fi
- name: Create Pull Request
if: steps.git-check.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore: update providers models [automated]'
title: 'chore: update providers models (auto)'
body: 'This PR was automatically generated by the updateProviders workflow.'
branch: auto/update-providers
delete-branch: true
labels: 'dependencies'
author: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>'
committer: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>'