Cleaning Up GH Classroom

Hello! The GH Organization that houses my classroom is cluttered with repos that were created from GH Classroom when students submitted an assignment. I have about 60 repos that look something like “BST692_A1_[studentUsername]”.

Last summer was the first time we used GH classroom for teaching. Does anyone know of a better way to do some housekeeping. The repos are private so future students won’t be able to see past student submissions but it’s an absolute eyesore to go to my org page and see 100 repos of past students’ assignment submissions. Any suggestions?

I really do not want to manually go through and delete all the repos.

Thank you!
LB

1 Like

It doesn’t look like it. I think, generally, what you see is what you get - there are no hidden features. :slight_smile: It would be nice if there was an “archive” option like there is for Classrooms. (of course then we’d also want a “batch archive” option as well).

Rob

1 Like

Hi @labouz

You may find our instructions to address the course wrap-up useful in this respect.

However, bear in mind that users have recently reported problems in deleting org repos at once using the classroom dashboard.

2 Likes

You can use the following powershell script just replace the token with your own personal access token. The org with the org under which the assignments are created. Finally change the prefix, in your case it seems to be BST692_A1_.

# personal access token
#see https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token

$token='**********************'

# organization under which the assignments are created
$org='NDU-CSC213'
$prefix='Homework1'
## No need to change anything below

$Headers=@{
    Authorization='token {0}' -f $token;
    };

$Uri='https://api.github.com/orgs/{0}/repos?per_page=100' -f $org
$repos=Invoke-RestMethod -Headers $Headers -Uri $Uri -Method Get

 foreach($repo in $repos){
## all repos that start with string $prefix
   if($repo.name.startsWith($prefix)){
# print the repo url
     $repo.html_url
     $name=$repo.name

# to see the list of the to be deleted repos without actually deleting
# them comment out the line below 

     Invoke-RestMethod -Headers $Headers -Uri https://api.github.com/repos/$org/$name -Method Delete
   }
 }
3 Likes

I follow this approach to housekeeping.
TL;DR Starter code is kept in a master org (e.g. BST692_master), then a new org is created for each edition of the class (e.g. BST692_spring21). GH Classroom would use the BST692_spring21 org, all student repos for that edition go in there.
Due to changes in GH Classroom permissions, a copy of each starter code repo would need to be created in the edition org, but I don’t find this to be a major overhead.

2 Likes

Thanks everyone!
What I have discovered is that by removing the assignments from the GH classroom - all the forked repos go too.
To me, this was the easiest way to remove all the students repos as I still have local copies of the assignments and they will likely need to get modified this iteration anyways.

I’m having a hard time finding a real use for GH classroom. We are an intro to data science course so I can’t really take advantage of the auto-grader features (i think). What we have decided to do is to have students create one repo for the course in which they will create sub-folders for each topic and submit their assignments by branching, creating a PR, i “code review”/submit feedback, and merging.

The GitHub command-line interface might be useful to you also, i’ve been using this recently when I need to do batch stuff with student repos.

1 Like

This is what I started doing a couple of years ago and have found that it works well. Since the original repos in my main org are also templates, I can easily just use that template to make a copy in this year’s org with a couple of clicks.

1 Like

I’ve not deleted any student repos since they may want to access it later on in their student or professional careers. I use a fresh org for each course I teach and at the end of the semester I archive it in Classroom (which doesn’t seem to do anything to the org itself) and replace the org image with a huge red X. It’s a long way from perfect but it strikes a decent balance if you want students to have access to their own code in the future.

2 Likes
© 2017 GitHub, Inc.
with by
GitHub Education