50 lines
1.7 KiB
YAML
50 lines
1.7 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:
|
|
# Configurazione OpenCode Zen & Modello
|
|
OPENCODE_ZEN_API_KEY: ${{ secrets.OPENCODE_ZEN_API_KEY }}
|
|
OPENCODE_API_BASE: https://opencode.ai/zen/v1
|
|
OPENCODE_MODEL: opencode/big-pickle
|
|
|
|
# Autenticazione e deviazione su Gitea (Nota il percorso /api/v1 finale obbligatorio)
|
|
GITHUB_API_URL: "https://maribit.it"
|
|
GITHUB_TOKEN: ${{ secrets.BOT_GITEA_TOKEN }}
|
|
|
|
# Variabili di contesto necessarie all'istanza di esecuzione
|
|
GITHUB_EVENT_PATH: ${{ github.event_path }}
|
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
run: |
|
|
# Configurazione Git locale per permettere all'agente di effettuare modifiche
|
|
git config --global user.name "OpenCode Bot"
|
|
git config --global user.email "opencode-bot@maribit.it"
|
|
|
|
# Eseguiamo il comando passando il file dell'evento tramite il parametro --event
|
|
# Le altre configurazioni (token, api, modello) vengono lette da OpenCode direttamente dall'ambiente (env)
|
|
opencode github run --event "$GITHUB_EVENT_PATH"
|