-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (50 loc) · 1.67 KB
/
opencode.yml
File metadata and controls
56 lines (50 loc) · 1.67 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
name: opencode
on:
workflow_dispatch:
inputs:
prompt:
description: 'Prompt for OpenCode'
required: true
type: string
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
opencode:
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event.comment.body, '/oc') ||
contains(github.event.comment.body, '/opencode')
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install OpenCode CLI
run: |
curl -fsSL https://opencode.ai/install | bash
echo "$HOME/.opencode/bin" >> $GITHUB_PATH
- name: Extract clean prompt
id: extract-prompt
env:
RAW_PROMPT: ${{ github.event_name == 'workflow_dispatch' && inputs.prompt || github.event.comment.body }}
run: |
# Remove everything before /oc or /opencode, and strip HTML/markdown
CLEAN_PROMPT=$(echo "$RAW_PROMPT" | sed -E 's/.*\/(oc|opencode)[[:space:]]*//i' | sed -E 's/<[^>]*>//g' | head -1)
if [ -z "$CLEAN_PROMPT" ]; then
CLEAN_PROMPT="Please analyze this issue or pull request"
fi
echo "clean_prompt=$CLEAN_PROMPT" >> $GITHUB_OUTPUT
- name: Run OpenCode
env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
opencode run "${{ steps.extract-prompt.outputs.clean_prompt }}" --model opencode/gpt-4o-mini