Skip to content

Commit

Permalink
feat: 🚧 incompletely revise tasks while prepping for adv course
Browse files Browse the repository at this point in the history
  • Loading branch information
lwjohnst86 committed Dec 14, 2024
1 parent 68e5d78 commit fa2926d
Showing 1 changed file with 93 additions and 87 deletions.
180 changes: 93 additions & 87 deletions vignettes/tasks.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@ knitr::opts_chunk$set(
)
library(tidyverse)
devtools::load_all()
precourse <- targets::tar_read(upcoming_precourse_survey)
```

These are the constants used for later functions.

```{r constants}
get_upcoming_course_dates("intro")[1]
course_date <- get_upcoming_course_dates("intro")[1]
course_level <- "intro" # list_course_ids()
course_name <- get_course_repo("intro")
org_gh_course_name <- glue::glue("{course_name}-{str_sub(course_date, end = 7)}")
```

```{r}
```

# Pre-course admin tasks

## Who didn't finish survey
Expand All @@ -32,7 +37,6 @@ Check those who didn't finish the survey yet. Do need the official list
to compare with, which can be deleted after the course.

```{r, eval=FALSE}
precourse <- targets::tar_read(upcoming_precourse_survey)
participants <- check_who_not_finish_survey(
precourse,
readr::read_csv(here::here("_ignore/official-participant-list.csv"))
Expand Down Expand Up @@ -136,19 +140,23 @@ round_down_to_even <- function(x) {
}
x
}
project_groups <- expand_grid(prefix = group_names, suffix = 1:2) |>
slice_head(n = round_down_to_even(nrow(precourse)) / 2) |>
glue::glue_data("{prefix}-{suffix}")
if (course_level %in% c("intro")) {
set.seed(12)
teams <- tibble(
username = sample(usernames, length(usernames)),
team_names = sample(praise::praise_parts$adjective, length(usernames) / 2) |>
rep(times = 2) |>
sample() |>
str_c("-project")
)
count(teams, team_names)
if (course_level %in% c("intro", "adv")) {
learners_in_groups <- assign_learners_to_groups(
precourse,
project_groups
)
count(learners_in_groups, team)
# View(learners_in_groups)
# Manually change if need be.
# learners_in_groups <- edit(learners_in_groups)
}
```

Expand All @@ -160,99 +168,97 @@ First, you need to create the organization manually. Use the value in
here as the name:

```{r}
# Name for organization.
org_gh_course_name
```

Check details of the organization and set permissions:
create_github_org <- function(id) {
# course_date <- get_upcoming_course_dates(id)[1]
course_date <- "2024-12-10"
course_name <- get_course_repo(id)
org_name <- glue::glue("{course_name}-{str_sub(course_date, end = 7)}")
cli::cli_inform(c(
"Create a GitHub organization with this name: {.val {org_name}} ",
"*" = "Go to {.href https://github.com/account/organizations/new?plan=free}"
))
continue <- yesno::yesno2("Have you finished creating the GitHub organization?")
if (!continue) {
cli::cli_abort("Organization wasn't created, stopping the function.")
}
```{r, eval=FALSE}
# org_set_repo_permission(org_gh_course_name, permission = "none")
org_sitrep(org_gh_course_name)
ghclass::org_set_repo_permission(org_name, permission = "none")
org_name
}
```

Invite participants onto GitHub:

```{r, eval=FALSE}
# org_invite(org_gh_course_name, precourse$github_username)
org_members(org_gh_course_name)
org_pending(org_gh_course_name)
```
## Create projects to push to repos

Then we can create the teams based on the group names:
Setting up the repos to have all the folders and files.

```{r, eval=FALSE}
team_create(org_gh_course_name, project_groups)
org_teams(org_gh_course_name)
clone_team_repos(org_gh_course_name)
```

Then assign the people to the teams.
```{r}
setup_team_projects <- function(
data,
organization) {
checkmate::check_data_frame(data)
checkmate::check_names(
data,
permutation.of = c("username", "team_names")
)
#
# Invite to the org
ghclass::org_invite(organization, data$username)
#
# Create the teams
ghclass::team_create(
organization,
unique(data$team_names)
)
teams <- ghclass::org_teams(organization)
#
# Invite users to the team
ghclass::team_invite(
organization,
data$username,
data$team_names
)
```{r, eval=FALSE}
# Use this to remove users from teams, if you mess up.
# bind_rows(
# team_members(org_gh_course_name),
# team_pending(org_gh_course_name)
# ) %>%
# distinct() %>%
# pwalk(\(team, user) team_remove(org = org_gh_course_name, user = user, team = team, team_type = "slug"))
team_invite(
org_gh_course_name,
learners_in_groups$github_username,
learners_in_groups$team
)
```
gh_repos <- ghclass::repo_create(organization, data$team_names)
gh_repos <- ghclass::org_repos(organization)
ghclass::repo_add_team(sort(gh_repos), sort(unique(data$team_names)))
setup_team_repos(organization)
}
We need to create repos for each team.
setup_team_projects(teams, "r-cubed-advanced-2024-12")
```{r, eval=FALSE}
gh_repos <- repo_create(org_gh_course_name, project_groups)
repo_add_team(sort(gh_repos), sort(unique(learners_in_groups$team)))
```

Then take instructors and assigned teams and convert them into a
Markdown table to paste into the planning issue.
```{r}
setup_instructor_team <- function(usernames, organization) {
ghclass::org_invite(organization, usernames)
ghclass::team_create(organization, "Helpers")
ghclass::team_invite(
organization,
usernames,
"Helpers"
)
```{r, eval=FALSE}
instructors_to_groups %>%
copy_instructors_to_groups_table(org_gh_course_name)
```
ghclass::org_repos(organization) %>%
purrr::walk(~ {
ghclass::repo_team_permission(
repo = .x,
team = "Helpers",
permission = "admin"
)
})
}
Create a Helpers only team, so the team can be assigned to all the
repos.
ghclass::org_teams("rostools")
ghclass::team_members("rostools", "Teaching")
```{r, eval=FALSE}
org_invite(org_gh_course_name, instructors$github_username)
team_create(org_gh_course_name, "Helpers")
team_invite(
org_gh_course_name,
instructors$github_username,
"Helpers"
setup_instructor_team(
c("AndersAskeland", "Isabellvse", "lwjohnst86"),
"r-cubed-advanced-2024-12"
)
```

Add helpers and instructors team to all repos and set permissions to
admin.

```{r, eval=FALSE}
org_repos(org_gh_course_name) %>%
walk(~ {
repo_team_permission(
repo = .x,
team = "Helpers",
permission = "admin"
)
})
```

## Create projects to push to repos

Setting up the repos to have all the folders and files.

```{r, eval=FALSE}
setup_team_repos(org_gh_course_name)
```

```{r, eval=FALSE}
clone_team_repos(org_gh_course_name)
```

0 comments on commit fa2926d

Please sign in to comment.