Skip to content

feat: add custom provider support to GitHub Action - #1488

Closed
ArykLAnderson wants to merge 2 commits into
anomalyco:devfrom
ArykLAnderson:github-action-custom-provider
Closed

feat: add custom provider support to GitHub Action#1488
ArykLAnderson wants to merge 2 commits into
anomalyco:devfrom
ArykLAnderson:github-action-custom-provider

Conversation

@ArykLAnderson

@ArykLAndersonArykLAnderson commented Aug 1, 2025

Copy link
Copy Markdown

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

InputDescriptionRequiredDefault
modelModel to use (overrides config file)No-
opencode_configPath to opencode config fileNoAuto-discovery
config_envEnvironment variables for config (multiline key=value format)No-
shareShare the opencode sessionNotrue for public repos

Usage Examples

Basic custom provider:

- uses: sst/opencode/github@latestenv:
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>
@github-actions

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

Sign up for freeto 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

@ArykLAnderson