Finished Idea: Integrating to Git / Github

Finished Idea: Integrating to Git / Github

by Aleksi Postari -
Number of replies: 1

Hi all fellow coderunners!


Here at Satakunta University of Applied Sciences, we have been using Coderunner for multiple courses ranging from basic development to databases to much more complex ROS (Robotics Operating System) integration. Here I am sharing an idea of how we took the coderunner to the next level, by giving the students tools to write their code using their IDE of choice instead of being limited to the ACE editor and by giving students the ability to create more complex projects, having even tens of different files and folders, which we can then test using our own unit testing tools, using coderunner.


The basic idea was that I wanted students to create their code in a repository (we use GitHub for everything), as that is the tool that every developer should know by heart. I came up with a simple question type for Coderunner that basically just clones the repository URL given, and then you can do anything with it, like run unit tests against it, check that certain files or folders exist, import modules and run the student code... I have attached here an example of this question type customization code. In this question type, the repository is cloned into the folder "repo". If cloning does not work, the student is informed of this.


This will result in a question like this, where students can just submit a URL to their Git / GitHub repository for each question, and you can then run any tests against it:



Now, the approach above only works with public repositories. If you want to also get private repositories working in GitHub (and students really should use private repositories in order not to leak answers to questions for other students or for next year's students), the approach is this:

- Create an account in GitHub for which the students are prompted to share their repository to

- In GitHub, when you are being invited to a repository, you have to manually accept it. To fix this problem, I have created a script that you can put to be running infinitely on any server, which will automatically accept (every 30 seconds) new requests to be a collaborator in a GitHub repository. You can find the script from this GitHub repository: https://github.com/kulttuuri/github-automatic-invitation-accept. You can use PM2 or any other tool that can put the script running in the background.


And should you also want to get this going in your Coderunner instance and have any problems implementing this, or for example, you improve the code snippets that I have above, let me know! :)

In reply to Aleksi Postari

Re: Finished Idea: Integrating to Git / Github

by Richard Lobb -
Thanks for posting, Aleksi. Sounds useful :-)