1
0
Fork 0
mirror of https://github.com/subosito/flutter-action.git synced 2024-08-16 10:19:50 +02:00

use @actions/http-client

This commit is contained in:
Alif Rachmawadi 2020-03-04 14:58:15 +00:00
parent 973907784f
commit b749ad466c
No known key found for this signature in database
GPG key ID: 79DA63C0F3A55BB1

View file

@ -3,7 +3,7 @@ import * as io from '@actions/io';
import * as tc from '@actions/tool-cache';
import * as fs from 'fs';
import * as path from 'path';
import * as restm from 'typed-rest-client/RestClient';
import * as httpm from '@actions/http-client';
import * as semver from 'semver';
const IS_WINDOWS = process.platform === 'win32';
@ -168,10 +168,10 @@ async function getLatestVersion(
channel: string
): Promise<string> {
const releasesUrl: string = `${storageUrl}/releases_${osName()}.json`;
const rest: restm.RestClient = new restm.RestClient('flutter-action');
const storage: IFlutterStorage | null = (await rest.get<IFlutterStorage | null>(
releasesUrl
)).result;
const http: httpm.HttpClient = new httpm.HttpClient('flutter-action');
const storage: IFlutterStorage | null = (
await http.getJson<IFlutterStorage | null>(releasesUrl)
).result;
if (!storage) {
throw new Error('unable to get latest version');