-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (102 loc) · 3.55 KB
/
opencode-pr.yml
File metadata and controls
118 lines (102 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: opencode
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
inputs:
pr_number:
description: 'PR number to review (triggered by test-writer)'
required: true
type: number
head_sha:
description: 'Head SHA of the PR to review'
required: true
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || inputs.pr_number }}
cancel-in-progress: true
jobs:
opencode:
if: >
(github.event_name == 'pull_request' && github.event.pull_request.draft == false) ||
github.event_name == 'workflow_dispatch'
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 45
permissions:
id-token: write
contents: write
pull-requests: write
issues: write
statuses: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.head_sha || github.event.pull_request.head.sha }}
fetch-depth: 0
token: ${{ github.token }}
- name: Resolve PR context
id: resolve-pr
env:
INPUT_PR_NUMBER: ${{ inputs.pr_number }}
INPUT_HEAD_SHA: ${{ inputs.head_sha }}
EVENT_PR_NUMBER: ${{ github.event.pull_request.number }}
EVENT_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: bash scripts/resolve_pr_context.sh
- name: Configure git
run: bash scripts/configure_git_identity.sh "github-actions[bot]" "github-actions[bot]@users.noreply.github.com"
- name: Fetch previous opencode reviews
id: previous-reviews
run: bash scripts/fetch_previous_opencode_reviews.sh
env:
GH_TOKEN: ${{ github.token }}
- name: Setup Nix
uses: ./.github/actions/setup-nix
- name: Prepare opencode cache
run: bash scripts/prepare_opencode_cache.sh
- name: Configure opencode CI permissions
run: bash scripts/configure_opencode_ci_permissions.sh
- uses: ./.github/actions/load-prompt
with:
prompt-file: .github/prompts/pr-review.md
variables: $PR_NUMBER $HEAD_SHA $PREVIOUS_REVIEWS
- name: Run opencode
id: ai_review
timeout-minutes: 40
uses: anomalyco/opencode/github@latest
env:
GITHUB_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ github.token }}
KIMI_API_KEY: ${{ secrets.KIMI_API_KEY }}
with:
model: kimi-for-coding/k2p6
use_github_token: true
prompt: ${{ env.PROMPT }}
- name: Dump opencode diagnostics
if: always()
env:
AI_REVIEW_OUTCOME: ${{ steps.ai_review.outcome }}
run: bash scripts/dump_opencode_diagnostics.sh
- name: Upload opencode diagnostics
if: always()
uses: actions/upload-artifact@v4
with:
name: opencode-diagnostics-${{ github.run_id }}-${{ github.run_attempt }}
path: |
/tmp/opencode-cache
~/.local/share/opencode
~/.cache/opencode
if-no-files-found: ignore
include-hidden-files: true
retention-days: 7
- name: Evaluate AI merge gate
id: ai_merge_gate
run: bash scripts/publish_ai_merge_gate.sh
env:
GH_TOKEN: ${{ github.token }}
- name: Mark AI review complete
if: always()
env:
AI_REVIEW_OUTCOME: ${{ steps.ai_review.outcome }}
GH_TOKEN: ${{ github.token }}
run: bash scripts/mark_ai_review_complete.sh