chore(deps): move from node-fetch to undici (#1148)

* chore(deps): move from node-fetch to undici

* fix: lint

* test: see if this is actually running

* test: skeptical

* test: post-install
This commit is contained in:
Tom Hu
2023-10-25 06:08:39 -07:00
committed by GitHub
parent aceeca9bb1
commit 83d30f0e41
6 changed files with 25576 additions and 13086 deletions

View File

@@ -4,7 +4,7 @@ import * as path from 'path';
import * as core from '@actions/core';
import * as openpgp from 'openpgp';
import * as fetch from 'node-fetch';
import {request} from 'undici';
import {
getBaseUrl,
@@ -30,18 +30,18 @@ const verify = async (
// Get SHASUM and SHASUM signature files
console.log(`${getBaseUrl(platform, version)}.SHA256SUM`);
const shasumRes = await fetch.default(
const shasumRes = await request(
`${getBaseUrl(platform, version)}.SHA256SUM`,
);
const shasum = await shasumRes.text();
const shasum = await shasumRes.body.text();
if (verbose) {
console.log(`Received SHA256SUM ${shasum}`);
}
const shaSigRes = await fetch.default(
const shaSigRes = await request(
`${getBaseUrl(platform, version)}.SHA256SUM.sig`,
);
const shaSig = await shaSigRes.text();
const shaSig = await shaSigRes.body.text();
if (verbose) {
console.log(`Received SHA256SUM signature ${shaSig}`);
}

View File

@@ -1,5 +1,5 @@
import * as core from '@actions/core';
import * as fetch from 'node-fetch';
import {request} from 'undici';
const versionInfo = async (
platform: string,
@@ -10,10 +10,10 @@ const versionInfo = async (
}
try {
const metadataRes = await fetch.default( `https://uploader.codecov.io/${platform}/latest`, {
const metadataRes = await request(`https://uploader.codecov.io/${platform}/latest`, {
headers: {'Accept': 'application/json'},
});
const metadata = await metadataRes.json();
const metadata = await metadataRes.body.json();
core.info(`==> Running version ${metadata['version']}`);
} catch (err) {
core.info(`Could not pull latest version information: ${err}`);