github / gh-classroom

GitHub Classroom CLI Extension is a powerful and easy-to-use command line tool that enhances the functionality of the GitHub CLI, specifically tailored for educators using GitHub Classroom.
MIT License
75 stars 12 forks source link

Bug: clone student-repos --page flag doesn't work for pages other than 1. #34

Closed a-tk closed 10 months ago

a-tk commented 11 months ago

Cloning some large repos all together in the same command often fails due to a timeout from Githubs API.

Using the classroom CLI's built in page functionality could work, but specifying a page other than 1 results in the creation of an empty directory and nothing else.

Some screenshots redacted to prevent student information from being visible.

Cloning the first page of 5 assignments:

gh classroom clone student-repos -a 555555 --page 1 --per-page 5

image

Requesting the next page:

gh classroom clone student-repos -a 555555 --page 2 --per-page 5

image

The solution mentioned in issues https://github.com/github/gh-classroom/issues/13 https://github.com/github/gh-classroom/issues/12 will not work because github API times out the clone command after about 20 of these repos are cloned.

The offending call appears to be this one to the API: https://github.com/github/gh-classroom/blob/main/pkg/classroom/http.go#L36

It may be that the page parameter is actually asking the API to get the second page of assignments, instead of the second page of the submissions?

a-tk commented 11 months ago

The comment that I made in the beginning of the post "Cloning some large repos all together in the same command often fails due to a timeout from Githubs API." does not appear to be true, but rather, network specific. On different networks, this command downloads all repositories fine.

Simply making the comment, that isn't the main point of this bug report, but important to clarify that it isn't the bug being identified.

shanep commented 10 months ago

I can confirm that the page argument doesn't seem to do anything past page 1. I have a new feature that I would like to contribute but am blocked due to this bug. This is also a show stopper for classes who have more than 100 students, so it would be awesome if this could be prioritized

I think that this is the same issue identified in #13

RyanHecht commented 10 months ago

Thanks for the report! We've opened an issue internally to fix it. @shanep, I'll make sure you get tagged in the PR that fixes it so you can open your PR for the "clone all" functionality (thanks for that, by the way, it will definitely alleviate pagination confusion!)

RyanHecht commented 10 months ago

Hey folks! Turns out this was a bug in our pagination logic in our API -- we've since merged the fix and pagination should work properly!

cc @shanep

a-tk commented 10 months ago

Fantastic, thanks for the quick attention!

Delonvdv commented 5 months ago

This is still failing If I try download any repo, regardless of size. It seems to download the first 14 then crash with I have tried --all panic: runtime error: index out of range [1] with length 1 I get the same regardless of what I try

This was working before, IM wondering if it has anything do to with the issues listed here: https://github.com/orgs/community/discussions/67264