mirror of
https://github.com/actions/setup-java.git
synced 2024-11-14 14:08:05 +00:00
feat: update logic of getting json file
This commit is contained in:
parent
3888c0a066
commit
cf4e1422a0
14
dist/setup/index.js
vendored
14
dist/setup/index.js
vendored
@ -102683,8 +102683,18 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const platform = this.getPlatformOption();
|
||||
const arch = this.distributionArchitecture();
|
||||
const availableVersionsUrl = 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json';
|
||||
const fetchedDragonwellVersions = (yield this.http.getJson(availableVersionsUrl)).result;
|
||||
const token = core.getInput('token');
|
||||
const auth = !token ? undefined : `token ${token}`;
|
||||
const owner = 'dragonwell-releng';
|
||||
const repository = 'dragonwell-setup-java';
|
||||
const branch = 'main';
|
||||
const filePath = 'releases.json';
|
||||
const availableVersionsUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`;
|
||||
const headers = {
|
||||
authorization: auth,
|
||||
accept: 'application/vnd.github.VERSION.raw'
|
||||
};
|
||||
const fetchedDragonwellVersions = (yield this.http.getJson(availableVersionsUrl, headers)).result;
|
||||
if (!fetchedDragonwellVersions) {
|
||||
throw new Error(`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import semver from 'semver';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import {OutgoingHttpHeaders} from 'http';
|
||||
|
||||
import {JavaBase} from '../base-installer';
|
||||
import {
|
||||
@ -61,11 +62,25 @@ export class DragonwellDistribution extends JavaBase {
|
||||
const platform = this.getPlatformOption();
|
||||
const arch = this.distributionArchitecture();
|
||||
|
||||
const availableVersionsUrl =
|
||||
'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json';
|
||||
const token = core.getInput('token');
|
||||
const auth = !token ? undefined : `token ${token}`;
|
||||
const owner = 'dragonwell-releng';
|
||||
const repository = 'dragonwell-setup-java';
|
||||
const branch = 'main';
|
||||
const filePath = 'releases.json';
|
||||
|
||||
const availableVersionsUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`;
|
||||
|
||||
const headers: OutgoingHttpHeaders = {
|
||||
authorization: auth,
|
||||
accept: 'application/vnd.github.VERSION.raw'
|
||||
};
|
||||
|
||||
const fetchedDragonwellVersions = (
|
||||
await this.http.getJson<IDragonwellAllVersions>(availableVersionsUrl)
|
||||
await this.http.getJson<IDragonwellAllVersions>(
|
||||
availableVersionsUrl,
|
||||
headers
|
||||
)
|
||||
).result;
|
||||
|
||||
if (!fetchedDragonwellVersions) {
|
||||
|
Loading…
Reference in New Issue
Block a user