send auth token to get container registry url endpoint

This commit is contained in:
Conor Sloan
2024-08-09 14:31:15 +01:00
parent f7d49cfdd1
commit ffcb1087c4
4 changed files with 54 additions and 12 deletions
+10 -2
View File
@@ -34,10 +34,18 @@ export async function getRepositoryMetadata(
}
export async function getContainerRegistryURL(
githubAPIURL: string
githubAPIURL: string,
token: string
): Promise<URL> {
const response = await fetch(
`${githubAPIURL}/packages/container-registry-url`
`${githubAPIURL}/packages/container-registry-url`,
{
method: 'GET',
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/vnd.github.v3+json'
}
}
)
if (!response.ok) {
throw new Error(
+4 -2
View File
@@ -92,8 +92,10 @@ export async function resolvePublishActionOptions(): Promise<PublishActionOption
}
// Required Values fetched from the GitHub API
const containerRegistryUrl: URL =
await apiClient.getContainerRegistryURL(apiBaseUrl)
const containerRegistryUrl: URL = await apiClient.getContainerRegistryURL(
apiBaseUrl,
token
)
const isEnterprise =
!githubServerUrl.includes('https://github.com') &&