Skip to content

Commit 9150217

Browse files
fix: version info reporting (#124)
the implementation of versionInfo was previously erroneous and would always print the latest version number
1 parent 983465b commit 9150217

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

dist/index.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32488,15 +32488,17 @@ const versionInfo = (platform, version) => version_awaiter(void 0, void 0, void
3248832488
if (version) {
3248932489
core.info(`==> Running version ${version}`);
3249032490
}
32491-
try {
32492-
const metadataRes = yield (0,undici.request)(`https://cli.codecov.io/api/${platform}/latest`, {
32493-
headers: { 'Accept': 'application/json' },
32494-
});
32495-
const metadata = yield metadataRes.body.json();
32496-
core.info(`==> Running version ${metadata['version']}`);
32497-
}
32498-
catch (err) {
32499-
core.info(`Could not pull latest version information: ${err}`);
32491+
else {
32492+
try {
32493+
const metadataRes = yield (0,undici.request)(`https://cli.codecov.io/api/${platform}/latest`, {
32494+
headers: { Accept: 'application/json' },
32495+
});
32496+
const metadata = yield metadataRes.body.json();
32497+
core.info(`==> Running version ${metadata['version']}`);
32498+
}
32499+
catch (err) {
32500+
core.info(`Could not pull latest version information: ${err}`);
32501+
}
3250032502
}
3250132503
});
3250232504
/* harmony default export */ const version = (versionInfo);

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/version.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@ const versionInfo = async (
77
): Promise<void> => {
88
if (version) {
99
core.info(`==> Running version ${version}`);
10-
}
11-
12-
try {
13-
const metadataRes = await request(`https://cli.codecov.io/api/${platform}/latest`, {
14-
headers: {'Accept': 'application/json'},
15-
});
16-
const metadata = await metadataRes.body.json();
17-
core.info(`==> Running version ${metadata['version']}`);
18-
} catch (err) {
19-
core.info(`Could not pull latest version information: ${err}`);
10+
} else {
11+
try {
12+
const metadataRes = await request(
13+
`https://cli.codecov.io/api/${platform}/latest`,
14+
{
15+
headers: {Accept: 'application/json'},
16+
},
17+
);
18+
const metadata = await metadataRes.body.json();
19+
core.info(`==> Running version ${metadata['version']}`);
20+
} catch (err) {
21+
core.info(`Could not pull latest version information: ${err}`);
22+
}
2023
}
2124
};
2225
export default versionInfo;

0 commit comments

Comments
 (0)