mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
ci(workflow): run monitor on the fork and open PRs against upstream
The monitor now executes on the leecoder/litellm fork: - checkout pins the upstream repo and its litellm_internal_staging base, so the monitor always audits upstream's registry, not the fork's - schedule guard skips upstream's own checkout (only the fork runs it); manual workflow_dispatch still works on upstream - changed rates push to a dated branch on the fork and open the PR against BerriAI/litellm with head leecoder:<branch> - PR identity: leecoder / leecoder@aol.com - auth uses the DBX_MONITOR_TOKEN secret (leecoder PAT with repo scopes); the default GITHUB_TOKEN cannot create PRs across forks - permissions trimmed to contents: write
This commit is contained in:
parent
5434a47585
commit
acc4a41f21
1 changed files with 25 additions and 11 deletions
36
.github/workflows/monitor_databricks_pricing.yml
vendored
36
.github/workflows/monitor_databricks_pricing.yml
vendored
|
|
@ -1,5 +1,8 @@
|
|||
name: Monitor Databricks Pricing
|
||||
|
||||
# Runs on the leecoder/litellm fork on a daily schedule. When the official
|
||||
# Databricks pricing pages drift from the registry, the monitor opens a PR
|
||||
# against the upstream repo (BerriAI/litellm) from a fork branch.
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 2 * * *" # daily 02:00 UTC
|
||||
|
|
@ -7,16 +10,25 @@ on:
|
|||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
env:
|
||||
FORK_REPO: leecoder/litellm
|
||||
UPSTREAM_REPO: BerriAI/litellm
|
||||
UPSTREAM_BASE: litellm_internal_staging
|
||||
|
||||
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'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
repository: ${{ env.UPSTREAM_REPO }}
|
||||
ref: ${{ env.UPSTREAM_BASE }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
|
||||
|
|
@ -24,6 +36,7 @@ jobs:
|
|||
python-version: "3.12"
|
||||
|
||||
- name: Run monitor
|
||||
id: monitor
|
||||
shell: bash
|
||||
run: |
|
||||
set -o pipefail
|
||||
|
|
@ -34,27 +47,28 @@ jobs:
|
|||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Open PR if changed
|
||||
- name: Open PR on upstream if changed
|
||||
if: steps.monitor.outputs.changed == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN_FOR_PUSH: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_TOKEN: ${{ secrets.DBX_MONITOR_TOKEN }} # leecoder PAT with repo + workflow scopes
|
||||
GITHUB_TOKEN_FOR_PUSH: ${{ secrets.DBX_MONITOR_TOKEN }}
|
||||
run: |
|
||||
BRANCH="monitor-dbx-pricing-$(date +'%Y-%m-%d')"
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config user.name "leecoder"
|
||||
git config user.email "leecoder@aol.com"
|
||||
git checkout -b "$BRANCH"
|
||||
git add model_prices_and_context_window.json litellm/model_prices_and_context_window_backup.json
|
||||
git commit -m "chore(model_prices): refresh Databricks Foundation Model Serving rates - automated monitor detected changed DBU rates on the Databricks pricing pages; refreshed the mapped databricks/* entries."
|
||||
git push "https://x-access-token:${GITHUB_TOKEN_FOR_PUSH}@github.com/${GITHUB_REPOSITORY}.git" "$BRANCH"
|
||||
git remote add fork "https://x-access-token:${GITHUB_TOKEN_FOR_PUSH}@github.com/${FORK_REPO}.git"
|
||||
git push fork "HEAD:refs/heads/$BRANCH"
|
||||
{
|
||||
cat /tmp/dbx_monitor_pr_body.md
|
||||
echo
|
||||
echo "---"
|
||||
echo "Auto-generated by the Databricks pricing monitor. \`PROMO_SKIPPED\`/\`REVIEW\`/\`MISSING_FROM_PAGE\` lines need human attention; \`UPDATED\` lines were applied automatically."
|
||||
echo "Auto-generated by the Databricks pricing monitor running on the ${FORK_REPO} fork. \`PROMO_SKIPPED\`/\`REVIEW\`/\`MISSING_FROM_PAGE\` lines need human attention; \`UPDATED\` lines were applied automatically."
|
||||
} > /tmp/dbx_pr_body_final.md
|
||||
gh pr create --repo "${{ github.repository }}" \
|
||||
--base litellm_internal_staging \
|
||||
--head "$BRANCH" \
|
||||
gh pr create --repo "$UPSTREAM_REPO" \
|
||||
--base "$UPSTREAM_BASE" \
|
||||
--head "leecoder:$BRANCH" \
|
||||
--title "chore(model_prices): refresh Databricks Foundation Model Serving rates" \
|
||||
--body-file /tmp/dbx_pr_body_final.md
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue