Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/ai-pr-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ jobs:

- name: Review
env:
LITELLM_API_KEY: ${{ secrets.LITELLM_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OPENROUTER_BASE_URL: ${{ secrets.OPENROUTER_BASE_URL }}
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
Expand All @@ -50,8 +51,8 @@ jobs:
run: |
set -euo pipefail

if [ -z "${LITELLM_API_KEY:-}" ]; then
echo "LITELLM_API_KEY not available, skipping review"
if [ -z "${OPENROUTER_API_KEY:-}" ]; then
echo "OPENROUTER_API_KEY not available, skipping review"
exit 0
fi

Expand All @@ -62,18 +63,19 @@ jobs:
--arg diff "$DIFF" \
--arg system "$SYSTEM_PROMPT" \
'{
model: "llm-gateway/claude-sonnet-4-6",
model: "anthropic/claude-sonnet-4.6",
max_tokens: 1024,
messages: [
{role: "system", content: $system},
{role: "user", content: ("PR: " + $title + "\n\nDiff:\n" + $diff)}
]
}' > /tmp/payload.json

BASE_URL="${OPENROUTER_BASE_URL:-https://openrouter.ai/api/v1}"
RESPONSE=$(curl -sf \
-H "Authorization: Bearer ${LITELLM_API_KEY}" \
-H "Authorization: Bearer ${OPENROUTER_API_KEY}" \
-H "Content-Type: application/json" \
"https://elastic.litellm-prod.ai/v1/chat/completions" \
"${BASE_URL%/}/chat/completions" \
-d @/tmp/payload.json)

CONTENT=$(echo "$RESPONSE" | jq -r '.choices[0].message.content // empty')
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/auto-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ jobs:
issue_number: ${{ github.event.issue.number }}
search_directory: packages
secrets:
LITELLM_API_KEY: ${{ secrets.LITELLM_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OPENROUTER_BASE_URL: ${{ secrets.OPENROUTER_BASE_URL }}
7 changes: 6 additions & 1 deletion .github/workflows/resolve-conflicts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ permissions:

jobs:
resolve:
if: |
(github.event.comment.user.login == 'github-actions[bot]' ||
github.event.comment.user.login == 'elastic-vault-github-plugin-prod[bot]') &&
contains(github.event.comment.body, 'To backport manually, run these commands')
uses: elastic/clients-team-automations/.github/workflows/ai-backport-resolver.yml@main
with:
comment_body: ${{ github.event.comment.body }}
comment_user: ${{ github.event.comment.user.login }}
pr_number: ${{ github.event.issue.number }}
secrets:
LITELLM_API_KEY: ${{ secrets.LITELLM_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OPENROUTER_BASE_URL: ${{ secrets.OPENROUTER_BASE_URL }}
Loading