1
0
mirror of https://github.com/pavlobu/deskreen.git synced 2025-05-17 16:00:16 -07:00
deskreen/app/utils/getNewVersionTag.ts
2021-01-17 23:45:59 +02:00

24 lines
590 B
TypeScript

/* eslint-disable @typescript-eslint/no-explicit-any */
import axios from 'axios';
const githubApiRepoTagsUrl =
'https://api.github.com/repos/pavlobu/circleCInodeapp/tags';
export default async function getNewVersionTag() {
let latestVersionTag = '';
const response = await axios({
url: githubApiRepoTagsUrl,
method: 'get',
headers: { 'User-Agent': 'node.js' },
});
const foundTag = response.data.find((tagData: any) => {
return (tagData.name as string).startsWith('v');
});
latestVersionTag = foundTag ? foundTag.name : '';
return latestVersionTag;
}