Skip to content

Commit

Permalink
fix: repair issue gathering
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Dec 6, 2024
1 parent fc79782 commit 779323c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/newsman/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

# This class represents a useful abstraction over Github API.
class Github

def initialize(token)
@client = Octokit::Client.new(github_token: token)
end
Expand All @@ -40,8 +41,8 @@ def pull_requests(username, repositories)

def issues(username, repositories)
one_year_ago = Date.today.prev_year.strftime('%Y-%m-%d')
query = "is:issue is:open author:#{username}"\
" author:0pdd created:>=#{one_year_ago} #{repositories}"
query = "is:issue is:open assignee:#{username}"\
" created:>=#{one_year_ago} #{repositories} label:#{IMPORTANT_ISSUE}"
puts "Searching issues using the following query: '#{query}'"
@client.search_issues(query).items.map do |issue|
parse_issue(issue)
Expand Down
8 changes: 6 additions & 2 deletions lib/newsman/issues.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
require 'net/http'
require 'json'

IMPORTANT_ISSUE = 'soon'

# This class represents a GitHub Issue abstraction created by a user.
class Issue


attr_accessor :title, :body, :repo, :number

def initialize(title, body, repo, number, **additional)
Expand Down Expand Up @@ -69,7 +73,7 @@ def to_json(*_args)
end

def important?
labels.include? 'soon'
labels.include? IMPORTANT_ISSUE
end
end

Expand Down Expand Up @@ -124,7 +128,7 @@ def to_json(*_args)
end

def important?
labels.include? 'soon'
labels.include? IMPORTANT_ISSUE
end

def url
Expand Down

0 comments on commit 779323c

Please sign in to comment.