This repository is used for the GitHub Intermediate training offering. It includes automation to drive the creation and management of training deliveries.
- Node.js 20.x or later
- A GitHub organization to host the class
- A GitHub personal access token with the following scopes:
repo
(Full control of private repositories)admin:org
(Full control of orgs and teams, read and write org projects)delete_repo
(Delete repositories)
-
Clone this repository to your local machine.
-
Install the dependencies:
npm install
-
Update the
classroom.json
file with the class information (see below). -
Create an environment variable,
GITHUB_TOKEN
, with your GitHub personal access token. This can be done in your terminal:export GITHUB_TOKEN=your_token_here
[!NOTE]
If you are using Windows, you can set the environment variable using the following command:
set GITHUB_TOKEN=your_token_here
The classroom.json
file is used to define the class and
its attendees/administrators. Before running any commands, you must update this
file with the following information:
Important
As you run various commands, the classroom.json
file will be updated with
the current state of the class. This includes the list of attendees and
administrators.
This should be the first action you run. It is responsible for creating a new classroom in the target organization.
node dist/index.js create
The following actions are performed:
- Create a new team in the target organization
- Adds all attendees to the team as members
- Adds all admins to the team as maintainers
- Creates a new repository for each attendee and administrator
- Grants the team access to each created repository
- Configures the labs for each repository
Once the class is complete, you can run this action to close the class.
node dist/index.js close
The following actions are performed:
- Deletes the all class repositories
- Removes all non-administrator users from the organization
- Deletes the class team
Note
Any administrator users will remain in the organization. If you need to remove them, this must be done manually.
If you need to add an attendee to the class, you can run this action.
node dist/index.js add-user <handle>
The following actions are performed:
- Invites the user to the organization
- Adds the user to the class team
- Creates a new repository for the user
- Grants the team access to the new repository
- Configures the labs for the new repository
If you need to remove an attendee from the class, you can run this action.
node dist/index.js remove-user <handle>
The following actions are performed:
- Removes the user from the organization
- Removes the user from the class team
- Deletes the user's repository
- Removes the team's access to the user's repository
If you need to add an admin to the class, you can run this action.
node dist/index.js add-admin <handle>
The following actions are performed:
- Invites the user to the organization
- Adds the user as a maintainer to the class team
- Creates a new repository for the user
- Grants the team access to the new repository
- Configures the labs for the new repository
If you need to remove an admin from the class, you can run this action.
node dist/index.js remove-admin <handle>
The following actions are performed:
- Removes the user from the organization
- Removes the user as a maintainer from the class team
- Deletes the user's repository
- Removes the team's access to the user's repository
Note
Unlike the close
action, this action will remove the administrator from
the organization. You will not be able to remove yourself from the class!