create initial script

This commit is contained in:
chair28980 2023-09-29 15:57:16 -07:00
parent e305e8e6c7
commit 32317ac6c7
1 changed files with 35 additions and 0 deletions

35
get_milestones.rb Normal file
View File

@ -0,0 +1,35 @@
require 'octokit'
require 'dotenv'
Dotenv.load(".env.local")
# Initialize the Octokit client
Octokit.configure do |c|
c.access_token = ENV['GITHUB_TOKEN'] # Make sure you set this environment variable or replace with your token
end
# Function to query a repository's data
def query_repo(organization, repo_name)
begin
# Fetch repository data
repo = Octokit.repo("#{organization}/#{repo_name}")
puts "Repository Name: #{repo.name}"
# Fetch issues for the repository
issues = Octokit.list_issues("#{organization}/#{repo_name}")
# Print details about each issue and its labels
issues.each do |issue|
puts "\nIssue Title: #{issue.title}"
puts "Labels: #{issue.labels.map(&:name).join(', ')}"
end
rescue Octokit::InvalidRepository => e
puts "Error: #{e.message}"
end
end
# Replace with your desired organization and repository name
query_repo('waku-org', 'pm')