abcclassroom.github.
add_remote
check_student_repo_exists
Check if the student has a repository for the course.
It happens that students delete their repository or do not accept the invitation to the course. In either case they will not have a repository yet.
clone_repo
Clone repository from org into a sub-directory in directory. Assumes you have ssh keys setup for github (rather than using GitHub API token).
close_existing_pullrequests
Close all oustanding course material update Pull Requests
If there are any PRs open in a student’s repository that originate from a branch starting with branch_base as name and created by the user we are logged in we close them.
commit_all_changes
Run git add, git commit on a given directory. Checks git status first and does nothing if no changes.
create_pr
Create a Pull Request with changes from branch
create_repo
Create a repository in the provided GitHub organization.
fetch_student
Fetch course repository for student from org
The repository will be cloned into a sub-directory in directory.
Returns the directory in which to find the students work.
get_access_token
Get a GitHub access token for the API
First tries to read from local token file. If token does not exist, or is not valid, generates a new token using the OAuth Device Flow. https://docs.github.com/en/free-pro-team@latest/developers/apps/ identifying-and-authorizing-users-for-github-apps#device-flow
Returns an access token (string).
get_commit_message
git_init
Initialize git repository
init_and_commit
Run git init, git add, git commit on given directory. Checks git status first and does nothing if no changes.
new_branch
Create a new git branch in directory
pull_from_github
Pull branch of local repo in directory from GitHub
push_to_github
Push branch back to GitHub
remote_repo_exists
Check if the remote repository exists for the organization.
repo_changed
Determine if the Git repository in directory is dirty