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
Question: Is there any way to check which student repositories have commits? #1074
Comments
Hi Connor, Not at present with the default commands. However, Repobee was designed with a plugin architecture that allows you to extend it to fit your context. Here's the documentation: https://docs.repobee.org/en/stable/repobee_plug/index.html#repobee-plug - it has some nice examples to help you get started. I guess you want to have a plugin that uses a Here's a bit of Python/Bash that will grab the username, assuming you are in the repo's directory. import subprocess
author = subprocess.check_output("git log -1 --pretty=format:'%an'", shell=True)
print(author.decode("utf-8").lower()) There might be a smarter Repobee way to get the last commit author (@slarse?) Let us know if you want to have a bash at it, or perhaps we can whip one up :) |
Alright, this is my first actual attempt at a plugin (started.py), but I like the use case so win-win for me. Here's something that works, but probably needs some improvement: import repobee_plug as plug
import subprocess
import os
@plug.repobee_hook
def post_clone(repo: plug.StudentRepo, api: plug.PlatformAPI):
os.chdir(repo.path)
last_commit_author = subprocess.check_output("git log -1 --pretty=format:'%an'", shell=True).decode("utf-8").strip().lower()
teachers = ["glassey"]
if last_commit_author in teachers:
print("[Repo Status]", repo.name, "has no student activity. The last commit was made by", last_commit_author) And the trace would look like this for a known non participating student, and silent if student has started: % repobee -p started.py repos clone -a task-1 -s xxxx --update-local
Cloning into student repos ...
Progress batch 1: 100%
Executing post_clone hooks:
[Repo Status] xxxx-task-1 has no student activity. The last commit was made by glassey
Executing post_clone hooks: 100% Probably smart to export to file, JSON or CSV if you have a lot of students :-) |
This is indeed a very good use case for a plugin, thanks @rjglasse for providing a prototype!
Nope, RepoBee doesn't deal with commits at present. However, GitPython provides a pretty nice Python interface to Git, I'd probably use that for better ergonomics. I think I use it somewhere in RepoBee but I forget where at the moment, but a plugin is free to have any dependencies it likes to as long as they don't conflict with the core dependencies (which is why I try to keep the amount of core dependencies tiny). |
Holy smokes, @rjglasse! I really appreciate that. It saves me a good couple of hours of faffing around trying to figure out where to start. |
Is there a way of checking if a student has done some work on a given assignment? Kind of like
check
for the reviews but instead of checking for the existence of issues, a way for checking if the student has done any work on the assignment.The text was updated successfully, but these errors were encountered: