Skip to content

Commit 83d9668

Browse files
authored
Merge pull request #8 from actions/sgoedecke/use-models-dot-github
Use org-owned endpoint
2 parents 2de3b6e + e5b8265 commit 83d9668

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

dist/index.js

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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)