Repository navigation
113 lines (110 loc) · 5.05 KB
/
Copy pathopencode.yml
File metadata and controls
113 lines (110 loc) · 5.05 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
name: opencode
run-name: "Issue #${{ github.event.issue.number }} — ${{ github.event.issue.title }}"
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
opencode:
# The triage and approve exclusions are prefix/contains based and mirror each
# other. Being slightly broad only under-runs an unknown "approve*"/"triage*"
# verb, which is the safe direction for an agent trigger.
if: |
(contains(github.event.comment.body, ' /oc ') ||
startsWith(github.event.comment.body, '/oc ')) &&
!(startsWith(github.event.comment.body, '/oc triage') ||
contains(github.event.comment.body, ' /oc triage')) &&
!(startsWith(github.event.comment.body, '/oc approve') ||
contains(github.event.comment.body, ' /oc approve')) &&
!contains(github.event.comment.body, 'opencode.ai/s/') &&
(github.event.comment.author_association == 'COLLABORATOR' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'OWNER')
runs-on: ubuntu-latest
timeout-minutes: 45
env:
# This forces actions to use Node 24 and clears the warning
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
# Single source for the model. Passed to the agent as `with: model` and
# read by .github/hooks/prepare-commit-msg to stamp each agent commit with
# an "Assisted-by: <model>" trailer. One place to change when the model
# changes, so the commit attribution cannot drift from the actual model.
OPENCODE_MODEL: opencode/deepseek-v4.1-flash-free
permissions:
id-token: write
contents: write
pull-requests: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
# Do not persist the automatic GITHUB_TOKEN. A push made with it is
# attributed to github-actions[bot], and GitHub then parks the PR's
# Java CI run in action_required (waiting for a maintainer to approve)
# instead of running it. The PAT is installed below instead.
persist-credentials: false
- name: Configure git identity
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
# Attribute agent commits to the maintainer, never a bot. GitHub renders
# the author avatar and the Contributors list from the git identity and
# from Co-authored-by: trailers; the model therefore rides only in an
# Assisted-by: trailer (see the prepare-commit-msg hook), which GitHub
# does not parse. The GitHub noreply keeps the personal email private.
git config user.name "LSantha"
git config user.email "LSantha@users.noreply.github.com"
# Git does not clone hooks, and core.hooksPath defaults to .git/hooks,
# so point it at the tracked hooks dir to install the attribution hook.
git config core.hooksPath "$GITHUB_WORKSPACE/.github/hooks"
# Authenticate pushes with the PAT so a pushed commit is attributed to
# the maintainer. Same-repo collaborator pushes are never approval
# gated; a GITHUB_TOKEN push makes the PR's Java CI run
# action_required and stalls the REVIEW/FEEDBACK loop until approved.
auth=$(printf 'x-access-token:%s' "$GH_PAT" | base64 -w0)
git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic $auth"
- name: Clone wiki
run: gh repo clone LSantha/jnode_ai.wiki .wiki
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'zulu'
- name: Install QEMU
run: sudo apt-get update -qq && sudo apt-get install -y -qq qemu-system-x86 socat
- name: Prepare jnode.properties
run: cp .github/qemu/jnode.properties .
- name: Cache ISO build
id: cache-iso
uses: actions/cache@v4
with:
path: all/build/cdroms/jnode-x86-lite.iso
key: jnode-iso-${{ hashFiles('**/*.java', '**/build.xml', 'build.sh') }}
- name: Build ISO
if: steps.cache-iso.outputs.cache-hit != 'true'
run: sh build.sh cd-x86-lite
- name: Run opencode
id: run_agent
uses: anomalyco/opencode/github@latest
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
with:
model: ${{ env.OPENCODE_MODEL }}
variant: high
use_github_token: true
- name: Apply agent/* label and close if work-product is the comment
if: success() || failure() || cancelled()
env:
PREV_CONCLUSION: ${{ steps.run_agent.outcome }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
script: |
const postStep = require('./.github/scripts/opencode-post-step.js');
await postStep({ github, context, core });