Skip to content

Commit 4738a2d

Browse files
committed
use org-owned endpoint
1 parent afaedf6 commit 4738a2d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,18 @@ export async function run(): Promise<void> {
2222
if (token === undefined) {
2323
throw new Error('GITHUB_TOKEN is not set')
2424
}
25-
const endpoint = core.getInput('endpoint')
25+
26+
let endpoint = core.getInput('endpoint')
27+
28+
// If we're in an org-owned repository, we should use the org-owned endpoint
29+
const repoOwner = process.env.GITHUB_REPOSITORY_OWNER
30+
const ownerType = process.env.GITHUB_REPOSITORY_OWNER_TYPE
31+
if (
32+
endpoint == 'https://models.github.ai/inference' &&
33+
ownerType == 'Organization'
34+
) {
35+
endpoint = `https://models.github.ai/${repoOwner}/inference`
36+
}
2637

2738
const client = ModelClient(endpoint, new AzureKeyCredential(token))
2839

0 commit comments

Comments
 (0)