feat: accept retrieval evidence before cache publication #58
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: AI Review | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, labeled] | |
| issues: | |
| types: [opened] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| fast-review: | |
| name: Fast PR Review | |
| if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') | |
| runs-on: self-hosted | |
| steps: | |
| - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get diff against base | |
| run: | | |
| git fetch origin "${{ github.event.pull_request.base.ref }}" --depth=50 | |
| git diff "origin/${{ github.event.pull_request.base.ref }}...HEAD" > /tmp/diff.txt | |
| - name: Ask OpenRouter for a quick pass | |
| run: | | |
| DIFF=$(head -c 12000 /tmp/diff.txt) | |
| PAYLOAD=$(jq -n --arg diff "$DIFF" '{ | |
| model: "openai/gpt-oss-20b:free", | |
| messages: [{ | |
| role: "user", | |
| content: ("Review this git diff. Reply with exactly 3 short bullet points flagging only obvious syntax or formatting issues — nothing else. If there are none, say so in one bullet.\n\nDiff:\n" + $diff) | |
| }] | |
| }') | |
| RESP=$(curl -sS https://openrouter.ai/api/v1/chat/completions \ | |
| -H "Authorization: Bearer $OPENROUTER_API_KEY" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD") | |
| echo "$RESP" | jq -r '.choices[0].message.content // "(no response from model)"' > /tmp/review.md | |
| { | |
| echo "**Fast review** (openai/gpt-oss-20b:free, automated)" | |
| echo "" | |
| cat /tmp/review.md | |
| } > /tmp/comment.md | |
| - name: Post comment | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh pr comment "${{ github.event.pull_request.number }}" --body-file /tmp/comment.md | |
| deep-review: | |
| name: Deep PR Review | |
| if: > | |
| github.event_name == 'pull_request' && | |
| (github.event.action == 'opened' || | |
| (github.event.action == 'labeled' && github.event.label.name == 'deep-review')) | |
| runs-on: self-hosted | |
| steps: | |
| - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get full diff against base | |
| run: | | |
| git fetch origin "${{ github.event.pull_request.base.ref }}" --depth=50 | |
| git diff "origin/${{ github.event.pull_request.base.ref }}...HEAD" > /tmp/diff.txt | |
| - name: Ask OpenRouter for architecture/edge-case review | |
| run: | | |
| DIFF=$(head -c 40000 /tmp/diff.txt) | |
| PAYLOAD=$(jq -n --arg diff "$DIFF" '{ | |
| model: "inclusionai/ling-3.0-flash:free", | |
| messages: [{ | |
| role: "user", | |
| content: ("Review this git diff for architecture concerns, runtime edge cases, and performance issues. Be concise — a short paragraph or a few bullets, not an essay.\n\nDiff:\n" + $diff) | |
| }] | |
| }') | |
| RESP=$(curl -sS https://openrouter.ai/api/v1/chat/completions \ | |
| -H "Authorization: Bearer $OPENROUTER_API_KEY" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD") | |
| echo "$RESP" | jq -r '.choices[0].message.content // "(no response from model)"' > /tmp/review.md | |
| { | |
| echo "**Deep review** (inclusionai/ling-3.0-flash:free, automated)" | |
| echo "" | |
| cat /tmp/review.md | |
| } > /tmp/comment.md | |
| - name: Post comment | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh pr comment "${{ github.event.pull_request.number }}" --body-file /tmp/comment.md | |
| issue-triage: | |
| name: Issue Triage | |
| if: github.event_name == 'issues' && github.event.action == 'opened' | |
| runs-on: self-hosted | |
| steps: | |
| - name: Ask OpenRouter for initial triage | |
| env: | |
| ISSUE_TITLE: ${{ github.event.issue.title }} | |
| ISSUE_BODY: ${{ github.event.issue.body }} | |
| run: | | |
| PAYLOAD=$(jq -n --arg title "$ISSUE_TITLE" --arg body "$ISSUE_BODY" '{ | |
| model: "openai/gpt-oss-20b:free", | |
| messages: [{ | |
| role: "user", | |
| content: ("Triage this new issue. If it is missing clear reproduction steps or key details, ask for exactly what is missing in 1-2 sentences. Otherwise give a one-line initial assessment.\n\nTitle: " + $title + "\n\nBody:\n" + $body) | |
| }] | |
| }') | |
| RESP=$(curl -sS https://openrouter.ai/api/v1/chat/completions \ | |
| -H "Authorization: Bearer $OPENROUTER_API_KEY" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD") | |
| echo "$RESP" | jq -r '.choices[0].message.content // "(no response from model)"' > /tmp/triage.md | |
| { | |
| echo "**Auto-triage** (openai/gpt-oss-20b:free, automated)" | |
| echo "" | |
| cat /tmp/triage.md | |
| } > /tmp/comment.md | |
| - name: Post comment | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh issue comment "${{ github.event.issue.number }}" --body-file /tmp/comment.md |