ci(workflow): fork-only schedule guard and script bootstrap

Two fixes for the fork-run setup:

- the monitor audits upstream's registry (checkout pins
  BerriAI/litellm@litellm_internal_staging), where the script does not
  exist until #38950 lands - bootstrap it from the fork branch when
  missing
- cron would fire on both repos once merged; guard the job to the fork
  so only leecoder/litellm opens PRs and upstream never races
This commit is contained in:
leecoder 2026-09-08 12:51:43 +09:00
parent acc4a41f21
commit d7317b9d7d

View file

@ -15,12 +15,13 @@ env:
FORK_REPO: leecoder/litellm
UPSTREAM_REPO: BerriAI/litellm
UPSTREAM_BASE: litellm_internal_staging
# carries the monitor script until PR #38950 lands upstream
SCRIPT_REF: feat/dbx-pricing-monitor-clean
jobs:
monitor-db-pricing:
# Upstream runs the same checkout on schedule; skip there so only the
# fork drives the monitor. Manual dispatch still works on upstream.
if: github.repository == 'leecoder/litellm' || github.event_name == 'workflow_dispatch'
# cron would fire on both repos after merge; only the fork may open PRs, or they'd race
if: github.repository == 'leecoder/litellm'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
@ -30,6 +31,14 @@ jobs:
repository: ${{ env.UPSTREAM_REPO }}
ref: ${{ env.UPSTREAM_BASE }}
- name: Bootstrap monitor script until #38950 lands upstream
run: |
if [ ! -f scripts/monitor_databricks_pricing.py ]; then
mkdir -p scripts
curl -fsSL "https://raw.githubusercontent.com/${FORK_REPO}/${SCRIPT_REF}/scripts/monitor_databricks_pricing.py" \
-o scripts/monitor_databricks_pricing.py
fi
- name: Set up Python
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with: