5
0
mirror of https://gitea.com/actions/setup-java.git synced 2026-08-07 02:31:20 +00:00

Fix JetBrains GitHub token resolution (#1224)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Julien Dubois
2026-08-06 17:46:13 +02:00
committed by GitHub
parent 5580b78434
commit 143564d5b9
6 changed files with 120 additions and 10 deletions
+5 -3
View File
@@ -77,10 +77,12 @@ class JetBrainsDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_
console.time('Retrieving available versions for JBR took'); // eslint-disable-line no-console
}
const rawVersions = [];
const bearerToken = process.env.GITHUB_TOKEN;
const requestHeaders = {};
const bearerToken = (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .getGitHubToken */ .lK)();
const requestHeaders = {
Accept: 'application/vnd.github+json'
};
if (bearerToken) {
requestHeaders['Authorization'] = `Bearer ${bearerToken}`;
requestHeaders.Authorization = `Bearer ${bearerToken}`;
}
let releasesUrl = JETBRAINS_RELEASES_URL;
let pageCount = 0;
+5 -1
View File
@@ -31265,6 +31265,7 @@ function validateToolchainIds(versions, versionFile, toolchainIds) {
/* harmony export */ ZY: () => (/* binding */ convertVersionToSemver),
/* harmony export */ aT: () => (/* binding */ isGhes),
/* harmony export */ ag: () => (/* binding */ getDownloadArchiveExtension),
/* harmony export */ lK: () => (/* binding */ getGitHubToken),
/* harmony export */ lN: () => (/* binding */ isJdkCacheEnabled),
/* harmony export */ n2: () => (/* binding */ renameWinArchive),
/* harmony export */ rC: () => (/* binding */ getNextPageUrlFromLinkHeader),
@@ -31699,8 +31700,11 @@ function getArtifactFingerprint(headers) {
}
return undefined;
}
function getGitHubToken() {
return _actions_core__WEBPACK_IMPORTED_MODULE_4__/* .getInput */ .V4('token') || process.env.GITHUB_TOKEN;
}
function getGitHubHttpHeaders() {
const resolvedToken = _actions_core__WEBPACK_IMPORTED_MODULE_4__/* .getInput */ .V4('token') || process.env.GITHUB_TOKEN;
const resolvedToken = getGitHubToken();
const auth = !resolvedToken ? undefined : `token ${resolvedToken}`;
const headers = {
accept: 'application/vnd.github.VERSION.raw'