-
Notifications
You must be signed in to change notification settings - Fork 847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to create repo groupgs from GH orgs on the CLI #923
Conversation
b83db69
to
4209436
Compare
Signed-off-by: Carter Landis <c@carterlandis.com>
4209436
to
19beec8
Compare
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.
see comment
augur/cli/db.py
Outdated
all_repos.append(repo) | ||
|
||
page+=1 | ||
repo_query_response = requests.get(org_query_response['repos_url'] + f"?per_page=100&page={page}", headers=headers).json() |
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.
page incrementing should be after you hit the endpoint
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.
It increments it after because it hits it once first and then needs to get the second request inside the loop, but looking back at it now that was a really wacky way to implement the loop and I'm gonna refactor it.
|
||
for repo in all_repos: | ||
logger.info(f"Adding {organization_name}/{repo['name']} ({repo['clone_url']})") | ||
result = augur_app.database.execute(insert_repo_sql, repo_group_id=new_repo_group_id, repo_git=repo['clone_url']) |
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.
There is a way to bulk insert which is faster, but if performance is not an issue (which I don't imagine it would be because I wouldn't think there would be an insane amount of repos in any org) then this implementation is just fine. So lmk if you want me to point you to some resources
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.
I considered a bulk insert but since there won't be too many repos for the vast majority of cases I went with this
Signed-off-by: Carter Landis <c@carterlandis.com>
@gabe-heim made changes to that request loop so it makes more sense, thoughts? |
@gabe-heim pinging 🛠️ |
Like the title says. Takes a GitHub org name, and (blindly, without dupe checking) creates a repo group with the same name. It then inserts all the repos from GitHub into that repo group.