Conversation
AI Code Review —
|
…s API URLs in configuration and tests
AI Code Review —
|
AI Code Review —
|
… in action configuration
AI Code Review —
|
AI Code Review —
|
- Added dependencies for @azure-rest/ai-inference and @azure/core-auth in package.json and package-lock.json. - Updated PROVIDER_BASES to change GitHub Models base URL. - Implemented isGithubModelsProvider function to identify GitHub Models provider. - Created askGitHubModels function to handle requests to the GitHub Models API. - Updated askAI function to route requests to GitHub Models when applicable. - Added licenses for new dependencies in licenses.txt.
AI Code Review —
|
AI Code Review —
|
| export function isGithubModelsProvider(provider: Provider | undefined, url: string): boolean { | ||
| return provider === "github-models" || url.includes(".inference.ai.azure.com"); | ||
| } |
There was a problem hiding this comment.
🟡 GitHub Models URL detection checks the old domain instead of the new one
The URL-based detection for the GitHub Models provider checks for the old domain .inference.ai.azure.com (url.includes(".inference.ai.azure.com") at src/config.ts:71) even though the base URL was changed to models.github.ai/inference, so custom-provider users pointing at the new endpoint will not be routed to the correct SDK path.
Impact: Users who set provider: custom with a models.github.ai URL will not get the GitHub Models SDK integration.
Mechanism: URL pattern mismatch after base URL migration
The PROVIDER_BASES["github-models"] was changed from https://models.inference.ai.azure.com to https://models.github.ai/inference at src/config.ts:24, but the newly added isGithubModelsProvider function at src/config.ts:70-72 still checks for the old domain pattern .inference.ai.azure.com. The URL-based fallback will never match the new URL. It should check for models.github.ai instead.
Was this helpful? React with 👍 or 👎 to provide feedback.
| // 2b. GitHub Models — ใช้ @azure-rest/ai-inference SDK อย่างเป็นทางการ | ||
| async function askGitHubModels(systemPrompt: string, userPrompt: string): Promise<string> { | ||
| const endpoint = PROVIDER_BASES["github-models"]!; | ||
| const token = GH_PAT ?? API_KEY; |
There was a problem hiding this comment.
🔴 GitHub Models authentication ignores the explicit API key and always uses the general-purpose token
The authentication token for GitHub Models is selected with wrong priority (GH_PAT ?? API_KEY at src/index.ts:155), so the explicitly provided API key is ignored whenever the general GitHub PAT is set — which is always, since it is a required input.
Impact: Users who provide a dedicated API key for GitHub Models will silently authenticate with the wrong credential, potentially causing authorization failures.
Mechanism: GH_PAT takes precedence over the resolved API_KEY
GH_PAT is the gh_pat input (required, always set). API_KEY at src/index.ts:41 is resolved as EXPLICIT_API_KEY ?? GH_PAT ?? "", meaning it already incorporates the explicit api_key input with GH_PAT as fallback. By writing GH_PAT ?? API_KEY, the code always picks GH_PAT (since it's always truthy for a required input), ignoring any explicitly provided api_key. All other API functions (askOpenAICompat, askAnthropic, askResponses) correctly use API_KEY. The fix should be API_KEY (or API_KEY ?? GH_PAT if a different priority is intended).
| const token = GH_PAT ?? API_KEY; | |
| const token = API_KEY || GH_PAT || ""; |
Was this helpful? React with 👍 or 👎 to provide feedback.
AI Code Review —
|
AI Code Review —
|
| description: "AI provider shorthand: copilot, github-models, openai, anthropic, openrouter, ollama, xai, zai, google, azure, aws, custom — sets api_url and api_type defaults automatically (azure/aws require api_url). Use github-models to authenticate with GITHUB_TOKEN without needing a personal PAT." | ||
| required: false | ||
| default: "github-models" | ||
| default: "github-azure-models" |
There was a problem hiding this comment.
🟡 Default provider in the action definition doesn't match what the documentation promises
The action's default provider is set to github-azure-models (action.yml:29) but the README documents the default as github-models, so users relying on the documented default will unknowingly hit a different API endpoint.
Impact: Users following the Quick Start guide without specifying a provider will connect to the Azure-hosted endpoint instead of the documented GitHub-hosted endpoint, which may behave differently or require different permissions.
Inconsistency between action.yml and README
The README at line 41 states:
| `provider` | | `github-models` | AI provider shorthand (see [Providers](#providers)) |
But action.yml:29 sets:
default: "github-azure-models"The github-azure-models provider resolves to https://models.inference.ai.azure.com while github-models resolves to https://models.github.ai/inference. These are different endpoints. Additionally, github-azure-models is not listed in the README's Providers table at all, so users have no documentation for the actual default behavior.
Prompt for agents
The action.yml default provider is set to 'github-azure-models' but the README documents the default as 'github-models'. Either update action.yml line 29 to use 'github-models' as the default (matching the README), or update the README to document 'github-azure-models' as the default and add it to the Providers table. The choice depends on which endpoint is preferred for the default zero-config experience.
Was this helpful? React with 👍 or 👎 to provide feedback.
…els API URL