From b5bfbd2bba87883b5965faf03fd1bb73858a9c75 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Mon, 17 Oct 2022 13:03:02 +0200 Subject: [PATCH] pass the token input through on GHES --- dist/setup/index.js | 3 ++- src/distributions/microsoft/installer.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index fe776b93..f6e0aaf1 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -104538,6 +104538,7 @@ class MicrosoftDistributions extends base_installer_1.JavaBase { // TODO get these dynamically! // We will need Microsoft to add an endpoint where we can query for versions. const token = core.getInput('token'); + const auth = !token ? undefined : `token ${token}`; const owner = 'actions'; const repository = 'setup-java'; const branch = 'main'; @@ -104545,7 +104546,7 @@ class MicrosoftDistributions extends base_installer_1.JavaBase { let releases = null; const fileUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; const headers = { - authorization: token, + authorization: auth, accept: 'application/vnd.github.VERSION.raw' }; let response = null; diff --git a/src/distributions/microsoft/installer.ts b/src/distributions/microsoft/installer.ts index 6284f961..6929fb2e 100644 --- a/src/distributions/microsoft/installer.ts +++ b/src/distributions/microsoft/installer.ts @@ -73,6 +73,7 @@ export class MicrosoftDistributions extends JavaBase { // TODO get these dynamically! // We will need Microsoft to add an endpoint where we can query for versions. const token = core.getInput('token'); + const auth = !token ? undefined : `token ${token}`; const owner = 'actions'; const repository = 'setup-java'; const branch = 'main'; @@ -82,7 +83,7 @@ export class MicrosoftDistributions extends JavaBase { const fileUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`; const headers: OutgoingHttpHeaders = { - authorization: token, + authorization: auth, accept: 'application/vnd.github.VERSION.raw' };