-
Notifications
You must be signed in to change notification settings - Fork 833
Fetching Organization Private Repos #149
base: master
Are you sure you want to change the base?
Conversation
Added function GetRepositoriesFromOrganization for downloading of private repo when target is an Organization using SSH URL
Hey @betobrandao, I'm trying to build your fork of Gitrob with this patch for an engagement but I'm getting the following error:
And trying to build manually:
Am I doing anything wrong? I tried to fix it but I don't know Go so I wasn't able to get it to compile. |
@njfox that's because the import path in the source doesn't match the directory structure of your clone ( https://golang.org/doc/code.html fwiw, is a concise overview of the basic mechanics for working with go code |
@@ -1,113 +1,151 @@ | |||
package core | |||
|
|||
import ( | |||
"context" | |||
"context" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you change the format? Wasn't it gofmt'd?
Thanks @tmatias, that worked. The patch also seems to have worked for fetching private organization repositories. |
Appreciate this work @betobrandao! Forked this repo as well and took much of your code, made a few more changes to get it working over HTTPS vs SSH using the same access token already provided. Thank you! |
@rayterrill @njfox
|
As discussed in Issue #76 the current version of GitRob is not able to fetch private repositories of organizations.
This patch adds a new function that uses the GitHub API method
Repositories.ListByOrg
to retrieve a list of all the repositories from an organization including the private ones if the access token given has access to them.After that, the
CloneURL
is set to theSSHURL
attribute of the GitHub object , allowing the cloning of the repositories over ssh. In the future it's possible to check if the repository is public before setting theCloneURL
, if public keeps using the HTTTPS URL, otherwise uses the SSHURL instead.The selection of what function to use is based on the target type.
The command
go fmt
was ran on thecore/github.go
file, that's why the diff is showing so many modifications.Added function GetRepositoriesFromOrganization for downloading of
private repo when target is an Organization using SSH URL