-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub script2.0 #96
base: main
Are you sure you want to change the base?
GitHub script2.0 #96
Changes from 9 commits
9aabb17
dd1f730
058a873
1c3f9c0
d0be6aa
9e220d8
5fcfe4b
452d647
00bb0e2
59a341e
d4c05a1
d3ccfbb
70eaf2c
6d36cdc
96ba812
5676c09
8ea5107
0795399
4feb1fd
2026642
21b3ced
978e057
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
source 'https://rubygems.org' | ||
|
||
ruby '3.2.2' | ||
ruby '< 3.0' | ||
|
||
gem 'octokit' | ||
gem 'csv' | ||
gem 'yaml' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
addressable (2.8.4) | ||
public_suffix (>= 2.0.2, < 6.0) | ||
csv (3.2.6) | ||
faraday (2.7.5) | ||
faraday-net_http (>= 2.0, < 3.1) | ||
ruby2_keywords (>= 0.0.4) | ||
faraday-net_http (3.0.2) | ||
octokit (6.1.1) | ||
faraday (>= 1, < 3) | ||
sawyer (~> 0.9) | ||
public_suffix (5.0.1) | ||
ruby2_keywords (0.0.5) | ||
sawyer (0.9.2) | ||
addressable (>= 2.3.5) | ||
faraday (>= 0.17.3, < 3) | ||
yaml (0.2.1) | ||
PLATFORMS | ||
x86_64-linux | ||
DEPENDENCIES | ||
csv | ||
octokit | ||
yaml | ||
RUBY VERSION | ||
ruby 3.2.2p53 | ||
BUNDLED WITH | ||
2.4.13 | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
addressable (2.8.5) | ||
public_suffix (>= 2.0.2, < 6.0) | ||
base64 (0.1.1) | ||
csv (3.2.7) | ||
faraday (2.7.11) | ||
base64 | ||
faraday-net_http (>= 2.0, < 3.1) | ||
ruby2_keywords (>= 0.0.4) | ||
faraday-net_http (3.0.2) | ||
octokit (4.25.1) | ||
faraday (>= 1, < 3) | ||
sawyer (~> 0.9) | ||
public_suffix (5.0.3) | ||
ruby2_keywords (0.0.5) | ||
sawyer (0.9.2) | ||
addressable (>= 2.3.5) | ||
faraday (>= 0.17.3, < 3) | ||
|
||
PLATFORMS | ||
arm64-darwin-22 | ||
|
||
DEPENDENCIES | ||
csv | ||
octokit | ||
|
||
RUBY VERSION | ||
ruby 2.6.10p210 | ||
|
||
BUNDLED WITH | ||
2.4.19 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,138 @@ | ||
# Bulk creation/deletion of many repos and cs169a-team | ||
# Bulk creation/deletion of many repos and student teams | ||
|
||
``` | ||
Usage: ./github-repos.rb [required options] [invite|repos|remove|remove_access] | ||
Usage: ./github-repos.rb [required options] [invite|create_teams|indiv_repos|team_repos|remove_indivi_repos|remove_team_repos|remove_teams|remove_team_repo_access] [optional options] | ||
|
||
GITHUB_ORG_API_KEY for the org must be set as an environment variable. | ||
|
||
'invite' invites students provided in .csv file and creates teams, 'repos' creates team repos, 'remove' remove students, repos, teams from the org | ||
|
||
It's safe to run multiple times. | ||
|
||
Required arguments: | ||
-c, --csv=CSVFILE CSV file containing at least "Team" and "Email" named columns | ||
-o, --orgname=ORGNAME The name of the org eg org_name | ||
-f, --filename=FILENAME The base filename for repos, eg "fa23-actionmap-04", actionmap is the base file name of the repo | ||
-p, --prefix=PREFIX Semester prefix, eg "fa23" create a repos prefix, "fa23-actionmap-04", etc. | ||
-t, --template=TEMPLATE The repo name within the org to use as template eg repo_name (Assume the repo own by org) | ||
'invite': | ||
Create a team called STUDENTTEAM under the org that has all students in the same semester and send invitation | ||
If STUDENTTEAM is already exist, the script will resent invitation to students. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "already exists", and "resend" |
||
(Temporary for special situations in Fa23) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this temporary? isn't this always the desired behavior? i really don't want to have changes in a script that are there for one semester only. let's discuss what special case is being addressed here and whether it can be addressed without creating a change now that will HAVE to be undone after the semester, since the rest of us have to live with these scripts after you're gone.... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the confusion here. The temporary means the optional prefix option. In the future, I believe we will not have child teams at the first few weeks. Child teams are for chip10.5 only. So, the invite command should invite students to the STUDENTTEAM rather than create child teams and invite them to those child teams. If the prefix option is provided, the scripts will assume there is 'Team' column in csv file, creates child teams, and invite students to child teams. |
||
If PREFIX is provided, it will assume the csv file contains "Team" column, and create child teams under | ||
the STUDENTTEAM, and invites them to child teams. | ||
|
||
Required options: | ||
-c, --csv=CSVFILE CSV file containing at leaset "Username" named columns | ||
-s, --studentteam=STUDENTTEAM The team name of all the students team | ||
-o, --orgname=ORGNAME The name of the org | ||
|
||
Optional options: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for optional options, you have to state what the default is if the option is not given |
||
-p, --prefix=PREFIX Semester prefix, eg fa23. | ||
|
||
'create_teams' (Not functioning) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does "Not functioning" mean in this case? |
||
Assuming students are in STUDENTTEAM, create child teams for students for CHIP 10.5 and add them to the child team. | ||
|
||
Required options: | ||
-c, --csv=CSVFILE CSV file containing at least "Team" and "Username" named columns | ||
-s, --studentteam=STUDENTTEAM The team name of all the students team | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i don't understand the documentation. is STUDENTTEAM a single large team containing all students in the class, or is each STUDENTTEAM a small team that shares a repo? i think TEAM is not a good name for these options if it means the first thing, since the word "Team" in the csvfile (previous option) means something completely different. |
||
-p, --prefix=PREFIX Semester prefix, eg fa23. | ||
-o, --orgname=ORGNAME The name of the org | ||
|
||
'indiv_repos' | ||
Create CHIPS repo for each stedent in STUDENTTEAM. Repos' names are form like "PREFIX-[username]-FILENAME" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: student |
||
|
||
Required options: | ||
-o, --orgname=ORGNAME The name of the org | ||
-s, --studentteam=STUDENTTEAM The team name of all the students team | ||
-p, --prefix=PREFIX Semester prefix, eg fa23. | ||
-t, --template=TEMPLATE The repo name within the org to use as template | ||
-g, --gsiteam=GSITEAM The team name of all the staff team | ||
-f, --filename=FILENAME The base filename for repos | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i don't understand "base filename for repos". repos don't have a filename(?) |
||
|
||
'team_repos' | ||
Create 10.5 repos for each child team. Repos' names are form like "PREFIX-FILENAME-[Team number]" | ||
Make sure child teams are formed before running this command. | ||
|
||
Required options: | ||
-o, --orgname=ORGNAME The name of the org | ||
-p, --prefix=PREFIX Semester prefix, eg fa23. | ||
-t, --template=TEMPLATE The repo name within the org to use as template | ||
-f, --filename=FILENAME The base filename for repos. | ||
-s, --studentteam=STUDENTTEAM The team name of all the students team | ||
-g, --gsiteam=GSITEAM The team name of all the staff team | ||
|
||
'remove_indiv_repos' | ||
Delete all repos whose names are formed like "PREFIX-[username]-FILENAME". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this be |
||
|
||
Required options: | ||
-o, --orgname=ORGNAME The name of the org | ||
-p, --prefix=PREFIX Semester prefix, eg fa23. | ||
-f, --filename=FILENAME The base filename for repos. | ||
|
||
'remove_team_repos' | ||
Delete all repos whose names are formed like "PREFIX-FILENAME-[Team number]". | ||
|
||
Required options: | ||
-o, --orgname=ORGNAME The name of the org | ||
-p, --prefix=PREFIX Semester prefix, eg fa23. | ||
-f, --filename=FILENAME The base filename for repos. | ||
|
||
'remove_teams' | ||
Remove all students and child teams in STUDENTTEAM from the org. | ||
Remove STUDENTTEAM as well. | ||
|
||
Required options: | ||
-o, --orgname=ORGNAME The name of the org | ||
-p, --prefix=PREFIX Semester prefix, eg fa23. | ||
-s, --studentteam=STUDENTTEAM The team name of all the students team | ||
|
||
'remove_team_repo_access' | ||
Remove students access to CHIP 10.5 repos that are formed like "PREFIX-FILENAME-[Team number]". | ||
|
||
Required options: | ||
-o, --orgname=ORGNAME The name of the org | ||
-p, --prefix=PREFIX Semester prefix, eg fa23. | ||
-f, --filename=FILENAME The base filename for repos. | ||
``` | ||
|
||
This script creates a team that include all stundents in the same semester, eg fa23. | ||
Then creates different child teams for them for the chip10.5. At a minimum, | ||
you need a CSV file listing all enrolled students with columns 'Email' and 'Team'. | ||
you need a CSV file listing all enrolled students with columns 'Username' and 'Team'. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does the Username column need to have the student's personal GitHub username, or something else? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Username column need to have the student's personal GitHub username. Since student will have emails other than berkerley email associated with GitHub. I think using GItHub username is better to invite students to org. |
||
The values in the Team columns should be nonnegative integers identifying teams. | ||
|
||
Org setting: Assume Base permissions is no permission, each students can only access their team repos. | ||
|
||
**Assumption:** You have a GITHUB ORG API key. | ||
|
||
### Create a team under the org that includes all students in the same semester | ||
### Create a team under the org that has all students in the same semester and send invitation | ||
|
||
**Use case:** Create a team called STUDENTTEAM, and send invitations | ||
to the students in csv file. If STUDENTTEAM exists, delete the team and | ||
create a new one. (Team repos still exist) | ||
For all students NOT in that team, add/invite into that team. | ||
to the students in csv file. If STUDENTTEAM exists, delete STUDENTTEAM and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this contradicts the comments near the beginning of the README about what happens if the team exists. which is correct?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will delete this. I believe if the STUDENTTEAM exists, sending invitation again is more reasonable. |
||
create a new one. (Team repos still exist) | ||
For all students NOT in STUDENTTEAM, add/invite into STUDENTTEAM. | ||
Team column is not needed for this. | ||
|
||
### Create child teams for students for CHIP 10.5 | ||
|
||
**Use case:** Create child teams for students for CHIP 10.5. | ||
|
||
### Create CHIPS repo for each stedent | ||
|
||
**Use case:** Create CHIP repos for each student in STUDENTTEAM. | ||
The repos' names are formed like "fa23-[username]-FILENAME". There will | ||
be only one collabrator. Add all repos to the gsiteam with admin permission. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Give GSITEAM admin access to the created repos." |
||
|
||
### Create 10.5 repos for each child team | ||
|
||
**Use case:** Each team (as identified by Team column in CSV file) | ||
gets a repo for chip 10.5. Repos' names are formed | ||
by concatenating the prefix, base file name, and the team ID. | ||
(eg "fa23-actionmap-04" for team #4) For all students on that team who do | ||
NOT already have access to the repo, give them write access on the repo. | ||
gets a repo for chip 10.5. Repos' names are formed like "PREFIX-FILENAME-TEAMNUM" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, this is confusing because you are using "TEAM" to mean both "a group of people on github in a single github team or child team" and "a small group of students working on a single repo/app". it might be less confusing to use "GROUP" to mean the second thing since github already uses "TEAM" for the first. |
||
Every one in the child team has write access to the repo. | ||
Add all repos to the gsiteam with admin permission. | ||
|
||
### Remove all team members from students team, and delete all the repos | ||
### Remove the CHIPS repos | ||
|
||
**Use case:** Delete all repos whose names are formed like "PREFIX-[username]-FILENAME". | ||
|
||
### Remove CHIP 10.5 repos | ||
|
||
**Use case:** Delete all repos whose names are formed like "PREFIX-FILENAME-[Team number]". | ||
|
||
### Remove all team members from students teams, then delete all teams | ||
|
||
**Use case:** Delete all repos whose name matches the "PREFIX-FILENAME-team number". | ||
Remove all students and subteams in STUDENTTEAM from the org. | ||
**Use case:** Remove all students and subteams in STUDENTTEAM from the org. | ||
|
||
### Remove student access to all the chip 10.5 repos | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure no typos in the list of all possible commands?