From 722dd813f17f72c0ecfcc1dd052bd19b42c613f0 Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Wed, 15 Feb 2023 17:31:43 +0530 Subject: [PATCH] we dont depend on repo api anymore other than for contents --- pages/repo.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/pages/repo.go b/pages/repo.go index 46ee460..3c19492 100644 --- a/pages/repo.go +++ b/pages/repo.go @@ -49,18 +49,6 @@ func HandleRepo(c *fiber.Ctx) error { }) } // API - repo := utils.GetRequest("https://api.github.com/repos/" + c.Params("user") + "/" + c.Params("repo")) - repoFiles := utils.GetRequest("https://api.github.com/repos/" + c.Params("user") + "/" + c.Params("repo") + "/contents") - bruh := repoFiles.Get("#.@pretty").Array() - for _, item := range bruh { - repoFilesArray = append(repoFilesArray, RepoFiles{ - Name: item.Get("path").String(), - Path: item.Get("path").String(), - Type: item.Get("type").String(), - Fullname: repo.Get("full_name").String(), - DefaultBranch: repo.Get("default_branch").String(), - }) - } // Scraping Scrape := Repo{} @@ -98,6 +86,19 @@ func HandleRepo(c *fiber.Ctx) error { // Add scrape-based info to repoArray repoArray = append(repoArray, Scrape) + // API + repoFiles := utils.GetRequest("https://api.github.com/repos/" + c.Params("user") + "/" + c.Params("repo") + "/contents") + bruh := repoFiles.Get("#.@pretty").Array() + for _, item := range bruh { + repoFilesArray = append(repoFilesArray, RepoFiles{ + Name: item.Get("path").String(), + Path: item.Get("path").String(), + Type: item.Get("type").String(), + Fullname: Scrape.Fullname, + DefaultBranch: Scrape.DefaultBranch, + }) + } + // README var readmee string err := requests.