Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(ci): pin the auto-merge request to the evaluated head sha

kerrya3d3fe4ada81
diff --git a/.github/scripts/auto_merge_price_sync.py b/.github/scripts/auto_merge_price_sync.py
index 2541a59812b..b0b8cb472e0 100644
--- a/.github/scripts/auto_merge_price_sync.py
+++ b/.github/scripts/auto_merge_price_sync.py
@@ -418,13 +418,12 @@ def _gather_inputs(
)
+def merge_request_body(pr: PullRequest) -> dict[str, str]:
+ return {"merge_method": "merge", "commit_title": f"{pr.title} (#{pr.number})", "sha": pr.head_sha}
+
+
def _merge(token: str, repo: str, pr: PullRequest) -> None:
- status, _ = _request_allow_fail(
- token,
- "PUT",
- f"/repos/{repo}/pulls/{pr.number}/merge",
- {"merge_method": "merge", "commit_title": f"{pr.title} (#{pr.number})"},
- )
+ status, _ = _request_allow_fail(token, "PUT", f"/repos/{repo}/pulls/{pr.number}/merge", merge_request_body(pr))
if status in (200, 405, 409):
print(f"auto-merge-price-sync: PR #{pr.number} merge call returned {status}")
return
diff --git a/tests/test_litellm/test_auto_merge_price_sync.py b/tests/test_litellm/test_auto_merge_price_sync.py
index 5f54483ccc0..cc174e801cf 100644
--- a/tests/test_litellm/test_auto_merge_price_sync.py
+++ b/tests/test_litellm/test_auto_merge_price_sync.py
@@ -300,6 +300,13 @@ def test_superseded_changes_requested_merges() -> None:
assert verdict.merge
+def test_merge_request_pins_evaluated_head_sha() -> None:
+ body: Final = merger.merge_request_body(_pr(number=7, title="sync prices"))
+ assert body["sha"] == HEAD_SHA
+ assert body["merge_method"] == "merge"
+ assert body["commit_title"] == "sync prices (#7)"
+
+
def test_classifier_cost_map_set_runs() -> None:
assert merger._classify(["model_prices_and_context_window.json", "tests/test_litellm/test_x.py"]) == "run"