-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_milestones.rb
48 lines (40 loc) · 1.16 KB
/
get_milestones.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require 'octokit'
require 'dotenv'
Dotenv.load(".env.local")
def query_repo
begin
client = Octokit::Client.new(access_token: ENV['GITHUB_TOKEN'])
repo = "waku-org/pm"
milestones = client.list_milestones(repo)
def extract_links(body)
body.scan(/https?:\/\/[\S]+/).uniq
end
milestones.each do |milestone|
puts "Milestone: #{milestone.title}"
puts "Link: #{milestone.html_url}"
if milestone.due_on
due_date = milestone.due_on.strftime('%Y-%m-%d')
puts "Due by: #{due_date}"
else
puts "No due date set."
end
puts "----------------------------"
issues = client.list_issues(repo, milestone: milestone.number)
issues.each do |issue|
puts "Epic: #{issue.title}"
puts "Link: #{issue.html_url}"
links = extract_links(issue.body)
if links.any?
puts "Issues in Epic:"
links.each { |link| puts link }
else
puts "No issues in Epic description."
end
puts "----------------------------"
end
end
rescue Octokit::InvalidRepository => e
puts "Error: #{e.message}"
end
end
query_repo