mirror of
https://github.com/opentofu/setup-opentofu.git
synced 2026-11-30 11:44:26 +01:00
Signed-off-by: Devin <hoopysoup@users.noreply.github.com>
This commit is contained in:
1 parent
dd259403c5
commit
5e2b22fba4
4 files changed
+994
-2690
No files matched your search
+11
-6
@@ -28,21 +28,26 @@ class Release {
|
||||
* @return {Array<Release>} Releases.
|
||||
*/
|
||||
async function fetchReleases (githubToken) {
|
||||
const hc = require('@actions/http-client');
|
||||
const userAgent = 'opentofu/setup-opentofu';
|
||||
|
||||
const http = new hc.HttpClient(userAgent);
|
||||
|
||||
const url = 'https://get.opentofu.org/tofu/api.json';
|
||||
|
||||
const headers = {
|
||||
Accept: 'application/json'
|
||||
};
|
||||
|
||||
const resp = await fetch(url, {
|
||||
headers
|
||||
});
|
||||
const resp = await http.get(url, headers);
|
||||
|
||||
if (!resp.ok) {
|
||||
throw new Error('failed fetching releases (' + resp.status + ')');
|
||||
if (resp.message.statusCode !== hc.HttpCodes.OK) {
|
||||
throw new Error('failed fetching releases (' + resp.message.statusCode + ')');
|
||||
}
|
||||
|
||||
let body = await resp.readBody();
|
||||
const releasesMeta = JSON.parse(body);
|
||||
|
||||
const releasesMeta = await resp.json();
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user