add support for dragonwell (#532)

* add support for dragonwell

* fix: update logic of parsing json file, refactor code

* build: rebuild action

* chore: update error message

* build: rebuild action

* tests: fix unit tests, add e2e tests

* chore: prettier, lint and rebuild solution

* feat: add check for the package type, update unit tests

* tests: update e2e tests

* tests: remove excess entries from e2e tests

* feat: update logic of getting json file

* feat: add logic for backuping getting json

* chore: update wordings

* chore: fix typos, add additional logs

* fix: fix review points

* chore: rebuild solution

* chore: update wordings

* chore: refactor code

---------

Co-authored-by: Ivan Zosimov <ivanzosimov@github.com>
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
This commit is contained in:
Accelerator1996 2023-09-20 19:22:11 +08:00 committed by GitHub
parent 4075bfc1b5
commit 0ab4596768
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 1918 additions and 20 deletions

View file

@ -4,10 +4,13 @@ import {
JavaInstallerOptions,
JavaInstallerResults
} from '../base-models';
import {extractJdkFile, getDownloadArchiveExtension} from '../../util';
import {
extractJdkFile,
getDownloadArchiveExtension,
getGitHubHttpHeaders
} from '../../util';
import * as core from '@actions/core';
import * as tc from '@actions/tool-cache';
import {OutgoingHttpHeaders} from 'http';
import fs from 'fs';
import path from 'path';
import {ITypedResponse} from '@actions/http-client/interfaces';
@ -85,8 +88,6 @@ export class MicrosoftDistributions extends JavaBase {
private async getAvailableVersions(): Promise<tc.IToolRelease[] | null> {
// 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';
@ -96,10 +97,7 @@ export class MicrosoftDistributions extends JavaBase {
let releases: tc.IToolRelease[] | null = null;
const fileUrl = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`;
const headers: OutgoingHttpHeaders = {
authorization: auth,
accept: 'application/vnd.github.VERSION.raw'
};
const headers = getGitHubHttpHeaders();
let response: ITypedResponse<tc.IToolRelease[]> | null = null;