Skip to content

Commit 0add427

Browse files
committed
ci(pricing): check LiteLLM updates twice daily
Run the LiteLLM pricing update workflow every twelve hours instead of weekly so pricing changes are discovered sooner. Compare model_prices_and_context_window.json before and after the flake update, and restore flake.lock when the pricing JSON is unchanged so automation does not open lock-only PRs.
1 parent d0d2491 commit 0add427

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

‎.github/workflows/update-pricing.yaml‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: update pricing
22

33
on:
44
schedule:
5-
- cron: '0 3 * * 1'
5+
- cron: '0 */12 * * *'
66
workflow_dispatch:
77

88
permissions:
@@ -15,9 +15,32 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1717
- uses: ./.github/actions/setup-nix
18+
- name: Capture current LiteLLM pricing JSON
19+
run: |
20+
rev="$(jq -r '.nodes.litellm.locked.rev' flake.lock)"
21+
curl --fail --location --silent --show-error \
22+
"https://raw.githubusercontent.com/BerriAI/litellm/${rev}/model_prices_and_context_window.json" \
23+
--output /tmp/litellm-pricing-before.json
1824
- name: Update LiteLLM pricing input
1925
run: |
2026
nix flake update litellm
27+
- name: Skip lock-only LiteLLM updates
28+
run: |
29+
rev="$(jq -r '.nodes.litellm.locked.rev' flake.lock)"
30+
curl --fail --location --silent --show-error \
31+
"https://raw.githubusercontent.com/BerriAI/litellm/${rev}/model_prices_and_context_window.json" \
32+
--output /tmp/litellm-pricing-after.json
33+
34+
if cmp --silent /tmp/litellm-pricing-before.json /tmp/litellm-pricing-after.json; then
35+
echo "LiteLLM pricing JSON is unchanged; skipping PR."
36+
git checkout -- flake.lock
37+
fi
38+
- name: Validate updated pricing snapshot
39+
run: |
40+
if git diff --quiet; then
41+
echo "Pricing snapshot is already up to date."
42+
exit 0
43+
fi
2144
nix flake check
2245
- name: Create pull request
2346
env:

0 commit comments

Comments
 (0)