52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
name: OpenCode Gitea Integration
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
dispatch:
|
|
types: [workflow_dispatch]
|
|
|
|
jobs:
|
|
opencode-gitea:
|
|
if: |
|
|
contains(github.event.comment.body, '/oc') ||
|
|
contains(github.event.comment.body, '/opencode')
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Install OpenCode CLI
|
|
run: |
|
|
curl -fsSL https://opencode.ai/install | bash
|
|
echo "$HOME/.opencode/bin" >> $GITHUB_PATH
|
|
|
|
- name: Execute OpenCode (Big Pickle)
|
|
env:
|
|
# OpenCode Zen Configuration
|
|
OPENCODE_ZEN_API_KEY: ${{ secrets.OPENCODE_ZEN_API_KEY }}
|
|
OPENCODE_API_BASE: https://opencode.ai/zen/v1
|
|
OPENCODE_MODEL: opencode/big-pickle
|
|
|
|
GITHUB_API_URL: "https://maribit.it"
|
|
GITHUB_TOKEN: ${{ secrets.BOT_GITEA_TOKEN }}
|
|
|
|
# Passiamo il contesto della issue corretto recuperato da Gitea
|
|
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
|
COMMENT_BODY: ${{ github.event.comment.body }}
|
|
REPO_NAME: ${{ github.repository }}
|
|
run: |
|
|
# Configuriamo git nel runner per evitare blocchi sui permessi locali
|
|
git config --global user.name "OpenCode Bot"
|
|
git config --global user.email "opencode-bot@maribit.it"
|
|
|
|
# Eseguiamo direttamente l'agente via CLI saltando i controlli bloccanti di GitHub
|
|
opencode github run \
|
|
--token "$GITHUB_TOKEN" \
|
|
--model "$OPENCODE_MODEL" \
|
|
--url "$GITHUB_API_URL"
|