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): isolate release wheel reporting permissions

Yujong Lee9dc9cd325cf5
diff --git a/.github/scripts/verify_linux_native_wheel.py b/.github/scripts/verify_linux_native_wheel.py
index b0ab34df98d..96264beb632 100644
--- a/.github/scripts/verify_linux_native_wheel.py
+++ b/.github/scripts/verify_linux_native_wheel.py
@@ -137,9 +137,6 @@ def main() -> int:
+ tuple(f"| {label} | Yes | {'O' if passed else 'X'} |" for label, passed in validations)
+ ("",)
)
- report_path: Final = os.environ.get("RELEASE_WHEEL_REPORT")
- if report_path is not None:
- Path(report_path).write_text(verified_report)
if summary_path is not None:
Path(summary_path).write_text(verified_report)
diff --git a/.github/workflows/report-rust-release-wheel.yml b/.github/workflows/report-rust-release-wheel.yml
new file mode 100644
index 00000000000..76aefd70ef6
--- /dev/null
+++ b/.github/workflows/report-rust-release-wheel.yml
@@ -0,0 +1,95 @@
+name: Report LiteLLM Rust release wheel
+
+on: # zizmor: ignore[dangerous-triggers] reporter executes no PR code and consumes no PR artifacts or outputs
+ workflow_run:
+ workflows:
+ - LiteLLM Rust
+ types:
+ - completed
+
+permissions: {}
+
+jobs:
+ report-release-wheel:
+ name: report release wheel
+ if: >-
+ github.event.workflow_run.conclusion == 'success' &&
+ github.event.workflow_run.event == 'pull_request' &&
+ github.event.workflow_run.path == '.github/workflows/test-rust.yml' &&
+ github.event.workflow_run.head_repository.full_name == github.repository &&
+ github.event.workflow_run.pull_requests[0].number != null
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ permissions:
+ issues: write
+
+ steps:
+ - name: Link release wheel report on PR
+ uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
+ env:
+ COMMENT_MARKER: "<!-- litellm-release-wheel-size -->"
+ with:
+ script: |
+ const marker = process.env.COMMENT_MARKER;
+ const workflowRun = context.payload.workflow_run;
+ if (
+ workflowRun.conclusion !== "success" ||
+ workflowRun.event !== "pull_request" ||
+ workflowRun.path !== ".github/workflows/test-rust.yml" ||
+ workflowRun.head_repository?.full_name !==
+ `${context.repo.owner}/${context.repo.repo}` ||
+ workflowRun.pull_requests?.length !== 1
+ ) {
+ throw new Error("unexpected source workflow");
+ }
+ const pullRequest = workflowRun.pull_requests[0];
+ const pullRequestNumber = pullRequest.number;
+ const headSha = workflowRun.head_sha;
+ const runId = workflowRun.id;
+ if (
+ !Number.isSafeInteger(pullRequestNumber) ||
+ pullRequestNumber <= 0 ||
+ !Number.isSafeInteger(runId) ||
+ runId <= 0 ||
+ !/^[0-9a-f]{40}$/.test(headSha) ||
+ pullRequest.head?.sha !== headSha
+ ) {
+ throw new Error("invalid source workflow metadata");
+ }
+ const runUrl =
+ `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}` +
+ `/actions/runs/${runId}`;
+ const body = [
+ marker,
+ "## LiteLLM Rust workflow",
+ "",
+ `Workflow completed successfully for \`${headSha}\``,
+ "",
+ `[View workflow run](${runUrl})`,
+ ].join("\n");
+ const comments = await github.paginate(github.rest.issues.listComments, {
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: pullRequestNumber,
+ per_page: 100,
+ });
+ const existing = comments.find(
+ (comment) =>
+ comment.user?.login === "github-actions[bot]" &&
+ comment.body?.startsWith(marker),
+ );
+ if (existing) {
+ await github.rest.issues.updateComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ comment_id: existing.id,
+ body,
+ });
+ } else {
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: pullRequestNumber,
+ body,
+ });
+ }
diff --git a/.github/workflows/test-rust.yml b/.github/workflows/test-rust.yml
index 1a9f36f24d2..b01e7fabe4a 100644
--- a/.github/workflows/test-rust.yml
+++ b/.github/workflows/test-rust.yml
@@ -84,7 +84,6 @@ jobs:
timeout-minutes: 20
permissions:
contents: read
- pull-requests: write
env:
CARGO_TERM_COLOR: always
@@ -126,7 +125,6 @@ jobs:
- name: Verify stripped native extension
env:
RELEASE_WHEEL_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
- RELEASE_WHEEL_REPORT: dist/release-wheel-report.md
run: python .github/scripts/verify_linux_native_wheel.py dist/*.whl
- name: Build panic contract wheel
@@ -137,43 +135,6 @@ jobs:
- name: Smoke-test native panic unwinding
run: python .github/scripts/smoke_test_native_wheel.py panic-dist/*.whl
- - name: Report release wheel size on PR
- if: >-
- github.event_name == 'pull_request' &&
- github.event.pull_request.head.repo.full_name == github.repository
- uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
- env:
- COMMENT_MARKER: "<!-- litellm-release-wheel-size -->"
- REPORT_PATH: dist/release-wheel-report.md
- with:
- script: |
- const fs = require("fs");
- const marker = process.env.COMMENT_MARKER;
- const report = fs.readFileSync(process.env.REPORT_PATH, "utf8");
- const body = `${marker}\n${report}`;
- const comments = await github.paginate(github.rest.issues.listComments, {
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: context.issue.number,
- per_page: 100,
- });
- const existing = comments.find((comment) => comment.body?.includes(marker));
- if (existing) {
- await github.rest.issues.updateComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- comment_id: existing.id,
- body,
- });
- } else {
- await github.rest.issues.createComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: context.issue.number,
- body,
- });
- }
-
- name: Upload release wheel
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with: