97 lines
3 KiB
YAML
97 lines
3 KiB
YAML
name: "opencode Forgejo Action"
|
|
description: "Run opencode in Forgejo Actions workflows"
|
|
branding:
|
|
icon: "code"
|
|
color: "blue"
|
|
|
|
inputs:
|
|
model:
|
|
description: "Model to use (format: provider/model)"
|
|
required: true
|
|
|
|
agent:
|
|
description: "Agent to use. Must be a primary agent."
|
|
required: false
|
|
|
|
share:
|
|
description: "Share the opencode session (defaults to true for public repos)"
|
|
required: false
|
|
|
|
prompt:
|
|
description: "Custom prompt to override the default prompt"
|
|
required: false
|
|
|
|
forgejo_api_url:
|
|
description: "Forgejo instance API URL (e.g., https://forgejo.example.com)"
|
|
required: false
|
|
default: "https://bitfreedom.net/code/"
|
|
|
|
forgejo_token:
|
|
description: "Forgejo PAT used by the outer action for read operations (clone, fetch, read APIs). Recommended scopes: read:repository, read:issue, read:user. Never exposed to the opencode subprocess."
|
|
required: false
|
|
|
|
forgejo_push_token:
|
|
description: "Optional separate Forgejo PAT used only for write operations (git push, create/update comments, create MR). Recommended scopes: write:repository, write:issue. Falls back to forgejo_token if unset."
|
|
required: false
|
|
|
|
mentions:
|
|
description: "Comma-separated list of trigger phrases. Defaults to '/opencode,/oc'"
|
|
required: false
|
|
default: "/opencode,/oc"
|
|
|
|
variant:
|
|
description: "Model variant for provider-specific reasoning effort (e.g., high, max, minimal)"
|
|
required: false
|
|
|
|
nomyo_api_key:
|
|
description: "Nomyo API key"
|
|
required: true
|
|
|
|
nomyo_api_url:
|
|
description: "Nomyo API base URL. Defaults to https://chat.nomyo.ai/api"
|
|
required: false
|
|
default: "https://chat.nomyo.ai/api"
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Install Bun
|
|
shell: bash
|
|
run: |
|
|
if ! command -v bun >/dev/null 2>&1; then
|
|
curl -fsSL https://bun.sh/install | bash
|
|
fi
|
|
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Install opencode
|
|
shell: bash
|
|
run: |
|
|
if ! command -v opencode >/dev/null 2>&1; then
|
|
curl -fsSL https://opencode.ai/install | bash
|
|
fi
|
|
echo "$HOME/.opencode/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Install action dependencies
|
|
shell: bash
|
|
working-directory: ${{ github.action_path }}
|
|
run: |
|
|
export PATH="$HOME/.bun/bin:$PATH"
|
|
bun install --frozen-lockfile
|
|
|
|
- name: Run opencode
|
|
shell: bash
|
|
env:
|
|
NOMYO_API_KEY: ${{ inputs.nomyo_api_key }}
|
|
NOMYO_API_URL: ${{ inputs.nomyo_api_url }}
|
|
MODEL: ${{ inputs.model }}
|
|
AGENT: ${{ inputs.agent }}
|
|
SHARE: ${{ inputs.share }}
|
|
PROMPT: ${{ inputs.prompt }}
|
|
FORGEJO_API_URL: ${{ inputs.forgejo_api_url }}
|
|
FORGEJO_TOKEN: ${{ inputs.forgejo_token }}
|
|
FORGEJO_PUSH_TOKEN: ${{ inputs.forgejo_push_token }}
|
|
MENTIONS: ${{ inputs.mentions }}
|
|
VARIANT: ${{ inputs.variant }}
|
|
run: |
|
|
export PATH="$HOME/.bun/bin:$HOME/.opencode/bin:$PATH"
|
|
bun run "${{ github.action_path }}/index.ts"
|