[THOG-774] - GitHub ignore repo full name (#848)

* Use github repo full name.

* fix tests.
This commit is contained in:
ahrav 2022-10-14 09:20:49 -07:00 committed by GitHub
parent d29357c9d4
commit 2d6aadcb46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -621,7 +621,7 @@ func (s *Source) getReposByOrg(ctx context.Context, org string) ([]string, error
s.log.Debugf("Listed repos for org %s page %d/%d", org, opts.Page, res.LastPage)
for _, r := range someRepos {
if s.ignoreRepo(r.GetName()) {
if s.ignoreRepo(r.GetFullName()) {
continue
}
@ -680,7 +680,7 @@ func (s *Source) getReposByUser(ctx context.Context, user string) ([]string, err
s.log.Debugf("Listed repos for user %s page %d/%d", user, opts.Page, res.LastPage)
for _, r := range someRepos {
if s.ignoreRepo(r.GetName()) {
if s.ignoreRepo(r.GetFullName()) {
continue
}

View file

@ -67,11 +67,11 @@ func TestAddReposByOrg(t *testing.T) {
Reply(200).
JSON([]map[string]string{
{"clone_url": "super-secret-repo", "name": "super-secret-repo"},
{"clone_url": "super-secret-repo2", "name": "super-secret-repo2"},
{"clone_url": "super-secret-repo2", "full_name": "secret/super-secret-repo2"},
})
s := initTestSource(nil)
s.ignoreRepos = []string{"super-secret-repo2"}
s.ignoreRepos = []string{"secret/super-secret-repo2"}
// gock works here because github.NewClient is using the default HTTP Transport
err := s.addRepos(context.TODO(), "super-secret-org", s.getReposByOrg)
assert.Nil(t, err)
@ -88,11 +88,11 @@ func TestAddReposByUser(t *testing.T) {
Reply(200).
JSON([]map[string]string{
{"clone_url": "super-secret-repo", "name": "super-secret-repo"},
{"clone_url": "super-secret-repo2", "name": "super-secret-repo2"},
{"clone_url": "super-secret-repo2", "full_name": "secret/super-secret-repo2"},
})
s := initTestSource(nil)
s.ignoreRepos = []string{"super-secret-repo2"}
s.ignoreRepos = []string{"secret/super-secret-repo2"}
err := s.addRepos(context.TODO(), "super-secret-user", s.getReposByUser)
assert.Nil(t, err)
assert.Equal(t, 1, len(s.repos))