From 4738a2d2121f85808721846a639438fccf918840 Mon Sep 17 00:00:00 2001 From: Sean Goedecke Date: Tue, 8 Apr 2025 04:55:27 +0000 Subject: [PATCH] use org-owned endpoint --- src/main.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 8f848b2..3639742 100644 --- a/src/main.ts +++ b/src/main.ts @@ -22,7 +22,18 @@ export async function run(): Promise { if (token === undefined) { throw new Error('GITHUB_TOKEN is not set') } - const endpoint = core.getInput('endpoint') + + let endpoint = core.getInput('endpoint') + + // If we're in an org-owned repository, we should use the org-owned endpoint + const repoOwner = process.env.GITHUB_REPOSITORY_OWNER + const ownerType = process.env.GITHUB_REPOSITORY_OWNER_TYPE + if ( + endpoint == 'https://models.github.ai/inference' && + ownerType == 'Organization' + ) { + endpoint = `https://models.github.ai/${repoOwner}/inference` + } const client = ModelClient(endpoint, new AzureKeyCredential(token))