Hi! As I understand it, the deadline passing will store the current most recent commit hash as a sort of tamper seal. My team has been considering a sort of early submission credit against late submissions and to do that we need to be able to accurately measure the time of the latest submission. I was planning on writing a quick script to mass clone & grab the time of the most recent commit for this, but I put on my security hat and realized that under that model students could falsify the time of their submission as long as they didn’t do it across the deadline boundary. My best solution so far is to have them submit the most recent commit hash on canvas, but that’s not super convenient so I was wondering if there is a way to handle this integrated into classrooms. Thanks!
There is no way to do that through the GH Classroom.
If you aim to script the check, you ought to retrieve the commit hashes and the corresponding time and carry out a comparison at each run with previously stored values.
You could enable webhooks in the classroom’s organization and configure it to send a POST request whenever someone pushes to a repo in that organization. There should be a
pushed_at timestamp somewhere in the payload. That would allow you to record the timestamp of whenever a student pushes to their assignment repo.
You’ll need to receive the POST request somewhere, then parse and store it.
Webhooks are great and to expand on @markpatterson27 's suggestion, you’d need to do one of the following:
- set up your own server (local or on the cloud) to receive the POST requests
- write up a GitHub Action to do the same job
With 1, it’s quite easy in my experience to run the task by resorting to
Sinatra. See reference.
With 2, you should only pay attention to the rate of requests your students are going to yield. If the action runs on a private repo, then you’ll have a limited minutes quota, although I think it’d be doable to have it running on public repos too.
Anyway, methodologically speaking, I wouldn’t penalize the students submitting at different hours on the same day (if the deadline is a matter of days). So, having the day as the finest granular time counter, doing things on polling rather than on event can be easier.
That said, polling or webhooks are things you’ll need to implement on your own and won’t integrate within the GH Classroom dashboard.
Thanks! I did some investigation on my own and I think for my use case the best thing to do is just to use the events API to gather the most recent push, truncate the timestamp down to a day, and use that as the record of what time an assignment was “submitted”. I don’t think that is falsifiable, so I should be good just scripting it and running it one-shot a few days after the deadline whenever I am ready to grade.