Merge pull request #8 from actions/sgoedecke/use-models-dot-github

Use org-owned endpoint
This commit is contained in:
Sean Goedecke
2025-04-08 20:05:22 +10:00
committed by GitHub
4 changed files with 22 additions and 4 deletions
+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="116" height="20" role="img" aria-label="Coverage: 77.27%"><title>Coverage: 77.27%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#e05d44"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">77.27%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">77.27%</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="116" height="20" role="img" aria-label="Coverage: 76.92%"><title>Coverage: 76.92%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#e05d44"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">76.92%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">76.92%</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Generated Vendored
+8 -1
View File
@@ -33566,7 +33566,14 @@ async function run() {
if (token === undefined) {
throw new Error('GITHUB_TOKEN is not set');
}
const endpoint = coreExports.getInput('endpoint');
let endpoint = coreExports.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 = createClient(endpoint, new AzureKeyCredential(token));
const response = await client.path('/chat/completions').post({
body: {
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+12 -1
View File
@@ -22,7 +22,18 @@ export async function run(): Promise<void> {
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))