Files
codecov-action/src/version.ts
Tom Hu 83d30f0e41 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
2023-10-25 06:08:39 -07:00

23 lines
624 B
TypeScript

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