we dont depend on repo api anymore other than for contents

This commit is contained in:
Arya Kiran
2023-02-15 17:31:43 +05:30
parent bbf3964b61
commit 722dd813f1
+13 -12
View File
@@ -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.