MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / build_github_workflow

Function build_github_workflow

crates/opencode-cli/src/main.rs:4090–4138  ·  view source on GitHub ↗
(model: &str)

Source from the content-addressed store, hash-verified

4088}
4089
4090fn build_github_workflow(model: &str) -> String {
4091 let provider = model.split('/').next().unwrap_or_default();
4092 let env_vars = provider_secret_keys(provider);
4093
4094 let mut env_block = String::new();
4095 if !env_vars.is_empty() {
4096 env_block.push_str(" env:\n");
4097 for key in env_vars {
4098 env_block.push_str(&format!(" {}: ${{{{ secrets.{} }}}}\n", key, key));
4099 }
4100 }
4101
4102 format!(
4103 "name: opencode
4104
4105on:
4106 issue_comment:
4107 types: [created]
4108 pull_request_review_comment:
4109 types: [created]
4110
4111jobs:
4112 opencode:
4113 if: |
4114 contains(github.event.comment.body, ' /oc') ||
4115 startsWith(github.event.comment.body, '/oc') ||
4116 contains(github.event.comment.body, ' /opencode') ||
4117 startsWith(github.event.comment.body, '/opencode')
4118 runs-on: ubuntu-latest
4119 permissions:
4120 id-token: write
4121 contents: read
4122 pull-requests: read
4123 issues: read
4124 steps:
4125 - name: Checkout repository
4126 uses: actions/checkout@v6
4127 with:
4128 persist-credentials: false
4129
4130 - name: Run opencode
4131 uses: anomalyco/opencode/github@latest
4132{env_block} with:
4133 model: {model}
4134",
4135 env_block = env_block,
4136 model = model
4137 )
4138}
4139
4140fn load_mock_event(event: &str) -> anyhow::Result<serde_json::Value> {
4141 let path = PathBuf::from(event);

Callers 1

handle_github_commandFunction · 0.85

Calls 3

provider_secret_keysFunction · 0.85
newFunction · 0.85
is_emptyMethod · 0.80

Tested by

no test coverage detected