From dfb131533a48ff41f94ef48bd08efbfae167900c Mon Sep 17 00:00:00 2001 From: Akshay Date: Thu, 16 Sep 2021 23:16:50 +0200 Subject: [PATCH] Issue-#766: Remove draft releases --- src/components/Repository/index.jsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/Repository/index.jsx b/src/components/Repository/index.jsx index 868eb3ba..531174b2 100644 --- a/src/components/Repository/index.jsx +++ b/src/components/Repository/index.jsx @@ -26,11 +26,12 @@ const queryGithub = graphql` totalCount } releases( - first: 1 + first: 2 orderBy: { field: CREATED_AT, direction: DESC } ) { edges { node { + isDraft tag { name } @@ -80,12 +81,21 @@ const Repository = ({ name, links, readme }) => ( }) .filter((n) => n) - const repo = repoFilteredArray[0] + var repo = repoFilteredArray[0] // safeguard against more empty items, // e.g. when private repos are referenced in repositories.yml if (repo === undefined) return null + const releasesFilteredArray = repo.releases.edges + .filter(({ node }) => { + return !node.isDraft + }) + .splice(1) + repo = { + ...repo, + releases: { edges: releasesFilteredArray } + } const { url, description, @@ -110,7 +120,6 @@ const Repository = ({ name, links, readme }) => ( }) const moreLinks = links || linksFilteredArray.filter((n) => n)[0] - return (