[PR #1488] [CLOSED] feat: add custom provider support to GitHub Action #9945

Closed
opened 2026-02-16 18:14:26 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/1488
Author: @ArykLAnderson
Created: 7/31/2025
Status: Closed

Base: devHead: github-action-custom-provider


📝 Commits (2)

  • 6967d44 feat: add custom provider support to GitHub Action
  • 9e90671 Fix action.yml env reference

📊 Changes

3 files changed (+187 additions, -20 deletions)

View changed files

📝 github/README.md (+76 -3)
📝 github/action.yml (+12 -2)
📝 packages/opencode/src/cli/cmd/github.ts (+99 -15)

📄 Description

Summary

Ref: https://github.com/sst/opencode/issues/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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/1488 **Author:** [@ArykLAnderson](https://github.com/ArykLAnderson) **Created:** 7/31/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `github-action-custom-provider` --- ### 📝 Commits (2) - [`6967d44`](https://github.com/anomalyco/opencode/commit/6967d444cb0ffefdf742fa8c84e855b2bb32ec69) feat: add custom provider support to GitHub Action - [`9e90671`](https://github.com/anomalyco/opencode/commit/9e9067152d63e865f595375eb9448e22941844f2) Fix action.yml env reference ### 📊 Changes **3 files changed** (+187 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `github/README.md` (+76 -3) 📝 `github/action.yml` (+12 -2) 📝 `packages/opencode/src/cli/cmd/github.ts` (+99 -15) </details> ### 📄 Description ## Summary Ref: https://github.com/sst/opencode/issues/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:** ```yaml - uses: sst/opencode/github@latest env: CUSTOM_API_KEY: ${{ secrets.CUSTOM_API_KEY }} BASE_URL=https://api.example.com # Automatically uses .github/opencode.json ``` ```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](https://opencode.ai) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:26 -05:00
yindo closed this issue 2026-02-16 18:14:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9945