From 5821310861360f1a65bb1914e2ba129c32c3fef9 Mon Sep 17 00:00:00 2001 From: Ruidy Nemausat Date: Wed, 20 May 2020 18:08:35 +0200 Subject: [PATCH] show only public repos --- src/services/github/index.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/services/github/index.ts b/src/services/github/index.ts index 98dc454..1f733dc 100644 --- a/src/services/github/index.ts +++ b/src/services/github/index.ts @@ -18,14 +18,17 @@ const getGithubRepos = async (owner: string) => { const {data: repos} = await octokit.repos.listForAuthenticatedUser({ owner, }); - const newRepo: Repo[] = repos.map((r: any) => ({ - url: r.url, - stars: r.stargazers_count, - forks: r.forks_count, - description: r.description, - name: r.name, - watchers: r.watchers_count, - })); + + const newRepo: Repo[] = repos + .filter((r: any) => r.private === false) + .map((r: any) => ({ + url: r.html_url, + stars: r.stargazers_count, + forks: r.forks_count, + description: r.description, + name: r.name, + watchers: r.watchers_count, + })); return newRepo; } catch (err) { console.error(err);