- Install dependencies
mkdir exercise
cd exercise
brew install rbenv
rbenv init
rbenv install 3.3.0
rbenv local 3.3.0
gem install octokit
-
Start VSCode and add the exercise directory to it.
-
Create .env file with GITHUB_TOKEN and GITHUB_ORG.
export GITHUB_TOKEN="<TOKEN>"
export GITHUB_ORG="<ORG NAME>"
-
Create repos.rb file in VSCode.
-
Add authentication to repos.rb:
require "octokit"
octokit = Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"])
-
Type
octokit.org
into the script, and see the available methods to use. -
Run the script:
source .env
ruby repos.rb
- Enjoy coding!
Reference: https://docs.github.com/en/rest/guides/scripting-with-the-rest-api-and-ruby?apiVersion=2022-11-28