build: investigate why fetching doesnt work

This commit is contained in:
xHyroM 2023-04-08 13:20:27 +02:00
parent 7d03f61f03
commit 5adef49cec
No known key found for this signature in database
GPG key ID: BE0423F386C436AA

View file

@ -92,21 +92,24 @@ const projects: Project[] = [
];
for (const project of projects) {
const repository = await (
await fetch(`https://api.github.com/repos/${project.link.slice(19)}`, {
headers: {
Authorization: `Bearer ${import.meta.env.GITHUB_ACCESS_TOKEN}`,
},
})
).json();
try {
const repository = await (
await fetch(`https://api.github.com/repos/${project.link.slice(19)}`, {
headers: {
Authorization: `Bearer ${import.meta.env.GITHUB_ACCESS_TOKEN}`,
},
})
).json();
console.log(import.meta.env);
console.log(repository); //debug
console.log(repository); //debug
project.stats = {
forks: repository.forks,
stars: repository.stargazers_count,
};
project.stats = {
forks: repository.forks,
stars: repository.stargazers_count,
};
} catch (e) {
console.log(e);
}
}
projects.sort((a, b) => a.name.localeCompare(b.name));