Skip to content

Conversation

ArykLAnderson
Copy link

@ArykLAnderson ArykLAnderson commented Aug 1, 2025

Summary

Ref: #1489

This PR adds comprehensive custom provider support to the opencode GitHub Action, enabling users to configure custom providers such as LiteLLM with secure environment variable injection.

Key Features Added

  • Custom Config Files: Auto-discovery of .github/opencode.json (primary), opencode.json, and .opencode/config.json
  • Environment Variable Injection: Support for config_env input
  • Backward Compatibility: Existing workflows continue working unchanged
  • Provider Integration: Proper integration with opencode's OPENCODE_CONFIG flag

New Action Inputs

Input Description Required Default
model Model to use (overrides config file) No -
opencode_config Path to opencode config file No Auto-discovery
config_env Environment variables for config (multiline key=value format) No -
share Share the opencode session No true for public repos

Usage Examples

Basic custom provider:

- uses: sst/opencode/github@latest
  env:
    CUSTOM_API_KEY: ${{ secrets.CUSTOM_API_KEY }}
    BASE_URL=https://api.example.com
  # Automatically uses .github/opencode.json
   {
     "model": "custom-provider/my-model",
     "provider": {
       "custom-provider": {
         "npm": "@ai-sdk/openai-compatible",
         "models": {
           "my-model": {
             "name": "My Custom Model"
           }
         },
         "options": {
           "apiKey": "{env:CUSTOM_API_KEY}",
           "baseURL": "{env:CUSTOM_BASE_URL}"
         }
       }
     }
   }
   

Technical Implementation

  • Environment Variable Parsing: Supports multiline key=value format for config_env
  • Config Discovery: Prioritizes .github/opencode.json for GitHub-specific configurations
  • Integration: Uses OPENCODE_CONFIG flag to properly integrate with opencode's config system

🤖 Generated with opencode

Enable custom LiteLLM provider configuration in GitHub Actions via config files and environment variables. This allows users to define custom providers with API keys, base URLs, and other options while keeping secrets secure.

Key changes:
- Add config and config_env inputs to GitHub Action
- Support auto-discovery of .github/opencode.json (primary), opencode.json, and .opencode/config.json
- Enable environment variable injection for config file placeholders (${VAR})
- Integrate with opencode's OPENCODE_CONFIG flag for proper config loading
- Maintain full backward compatibility with existing MODEL parameter workflows
- Add comprehensive documentation with usage examples

🤖 Generated with [opencode](https://opencode.ai)

Co-Authored-By: opencode <noreply@opencode.ai>
teamgroove pushed a commit to teamgroove/opencode that referenced this pull request Aug 3, 2025
Merged from: sst#1488
Author: @ArykLAnderson
Auto-merged by opencode-fork integration system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant