update script and readme

This commit is contained in:
chair28980 2023-09-30 01:34:40 -07:00
parent 2cbc1207fd
commit a014a9d2de
3 changed files with 27 additions and 22 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
.env.local
.byebug_history

View File

@ -5,3 +5,11 @@
```bash
bundle exec ruby get_milestones.rb
```
## gems
```
byebug
octokit
dotenv
```

View File

@ -3,33 +3,30 @@ 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)
def query_repo
begin
# Fetch repository data
repo = Octokit.repo("#{organization}/#{repo_name}")
client = Octokit::Client.new(access_token: ENV['GITHUB_TOKEN'])
repo = "waku-org/pm"
milestones = client.list_milestones(repo)
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
milestones.each do |milestone|
puts "Milestone: #{milestone.title}"
puts "Link: #{milestone.html_url}"
puts "----------------------------"
issues = client.list_issues(repo, milestone: milestone.number)
issues.each do |issue|
puts "Issue: #{issue.title}"
puts "Link: #{issue.html_url}"
puts "----------------------------"
end
puts "\n"
end
rescue Octokit::InvalidRepository => e
puts "Error: #{e.message}"
end
end
# Replace with your desired organization and repository name
query_repo('waku-org', 'pm')
query_repo