mirror of
https://github.com/codecov/codecov-action.git
synced 2026-02-11 12:51:37 +00:00
Allow specifying version of Codecov uploader
This commit is contained in:
19
src/version.ts
Normal file
19
src/version.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as fetch from 'node-fetch';
|
||||
|
||||
const versionInfo = async (platform: string, version?: string) => {
|
||||
if (version) {
|
||||
core.info(`==> Running version ${version}`);
|
||||
}
|
||||
|
||||
try {
|
||||
const metadataRes = await fetch( `https://uploader.codecov.io/${platform}/latest`, {
|
||||
headers: {'Accept': 'application/json'},
|
||||
});
|
||||
const metadata = await metadataRes.json();
|
||||
core.info(`==> Running version ${metadata['version']}`);
|
||||
} catch (err) {
|
||||
core.info(`Could not pull latest version information: ${err}`);
|
||||
}
|
||||
};
|
||||
export default versionInfo;
|
||||
Reference in New Issue
Block a user