Skip to content

Commit 0cf9522

Browse files
authored
Add the Event Trigger (#115)
* Add the Event Trigger * Add the opencode GitHub Actions * Add the opencode GitHub Actions
1 parent 5fe65b9 commit 0cf9522

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

.github/actions/opencode/actions

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "opencode GitHub Action"
2+
description: "Run opencode in GitHub Actions workflows"
3+
branding:
4+
icon: "code"
5+
color: "orange"
6+
7+
inputs:
8+
model:
9+
description: "Model to use"
10+
required: false
11+
12+
share:
13+
description: "Share the opencode session (defaults to true for public repos)"
14+
required: false
15+
16+
prompt:
17+
description: "Prompt to run"
18+
required: false
19+
20+
runs:
21+
using: "composite"
22+
steps:
23+
- name: Install opencode
24+
shell: bash
25+
run: curl -fsSL https://opencode.ai/install | bash
26+
27+
- name: Run opencode
28+
shell: bash
29+
id: run_opencode
30+
run: opencode run -p "${{ inputs.prompt }}" || true
31+
env:
32+
MODEL: ${{ inputs.model }}
33+
SHARE: ${{ inputs.share }}

.github/workflows/opencode.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ on:
44
issue_comment:
55
types: [created]
66

7+
pull_request:
8+
9+
pull_request_comment:
10+
types: [created]
11+
12+
pull_request_review:
13+
types: [submitted]
14+
15+
pull_request_review_comment:
16+
types: [created]
17+
718
jobs:
819
opencode:
920
if: |
@@ -21,7 +32,17 @@ jobs:
2132

2233
- name: Run opencode
2334
uses: sst/opencode/github@latest
35+
if: github.event_name != 'pull_request'
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
with:
39+
model: github-copilot/gpt-4.1
40+
41+
- name: Run opencode (for pull request)
42+
uses: ./github/actions/opencode
43+
if: github.event_name == 'pull_request'
2444
env:
2545
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2646
with:
2747
model: github-copilot/gpt-4.1
48+
prompt: ${{ github.event.comment.body }}

0 commit comments

Comments
 (0)