Skip to content

Latest commit

 

History

History
68 lines (49 loc) · 2.3 KB

README.md

File metadata and controls

68 lines (49 loc) · 2.3 KB

Github R Course Administration Utilities

Spencer Nystrom

Inspired by: Happy Git with R

Prerequisites to using these tools

You will need to manually create a github organization and a team for students. At a minimum, you will also need a list of your students github usernames.

A good template to follow can be found here.

You'll also want to create a github token with admin access to your org.

Setting up your course with these scripts

Requirements:

pkgs <- c("magrittr", "purrr", "gh", "dplyr", "glue")
install.packages(pkgs)

Quickstart:

These scripts will:

  1. Create repos for each student
  2. Add students to student team
  3. Give student team read access to other student repos
    • instructors should have push access by default if you set up the instructor team correctly
  4. Add each student as collaborator to org with push access to their own repo
  5. Unwatch student repos so you don't get notifications every time they push

Note: The following examples assume you've saved your github token in a plaintext file called 'auth.txt'

Configure your working environment:

source("github_functions")

orgName <- "organization_name"
teamName <- "students_team_name"
auth <- readr::read_file("auth.txt") %>%
	gsub("\n", "", .)

userNames <- c("testuser1", "testuser2")

Setup (Quick)

This will create a repository named after each students' username. repoNames below can be any list that is parallel to userNames.

setup_course_repos(repoNames = userNames, userNames = userNames, orgName, teamName, auth)

Note: This defaults to making private repositories. This can be changed by passing private = F. Register your Org with Github as an academic organization for free private repos.

You can also disable auto-initialization with README with auto_init = F.

Troubleshooting

repo names must not contain non-standard characters

Github will replace nonstandard characters like ' with - during creation, but if the character is present in your repo names vector, you'll get errors. Ensure your repo names vector only contains non-special characters.

Delete repos if there are issues (this is usually not necessary)

purrr::map(userNames, ~{delete_student_repo(orgName, ., auth)})