Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions scripts/github-repos/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ruby:3.2.2-bookworm

WORKDIR /app

COPY ["Gemfile", "/app/Gemfile"]
COPY ["Gemfile.lock", "/app/Gemfile.lock"]

run bundle install

COPY ["github-repos.rb", "/app/github-repos.rb"]

ENTRYPOINT ["ruby", "github-repos.rb"]
26 changes: 26 additions & 0 deletions scripts/github-repos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,29 @@ Remove all students and subteams in STUDENTTEAM from the org.
**Use case:** Only remove the access of students teams, repos still can be accessed by
gsi team.

## Running with Docker

Instead of switching to the right Ruby version manually, you can also build and use a Docker image to run this script.

### To build

To create the Docker image, clone this repository, cd into the script directory, and run:

```
docker build -t saasbook-script-github-repos .
```

### To run

Run the following, replacing the appropriate parameters.

If using Windows, you may need to change the `` `pwd` `` mount. Files in the working directory will be available to the container at `/app/files`, e.g. `-c /app/files/team-info.csv`.

```
docker run \
-v `pwd`:/app/files \
-e GITHUB_ORG_API_KEY=[ghp_your_key] \
saasbook-script-github-repos \
[args] \
[command]
```
4 changes: 1 addition & 3 deletions scripts/github-repos/github-repos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
require 'octokit'
require 'csv'

ENV['GITHUB_ORG_API_KEY'] = ""

def main()
puts "Script start."
org = OrgManager.new
Expand Down Expand Up @@ -223,4 +221,4 @@ def remove_access
end
end

main
main