Class: Metanorma::Release::Platform::GitHub::TopicDiscoverer

Inherits:
Object
  • Object
show all
Includes:
RepoDiscoverer
Defined in:
lib/metanorma/release/platform/github/topic_discoverer.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, organizations:, topic:) ⇒ TopicDiscoverer

Returns a new instance of TopicDiscoverer.



10
11
12
13
14
# File 'lib/metanorma/release/platform/github/topic_discoverer.rb', line 10

def initialize(client:, organizations:, topic:)
  @client = client
  @organizations = organizations
  @topic = topic
end

Instance Method Details

#discoverObject



16
17
18
19
20
21
22
23
24
# File 'lib/metanorma/release/platform/github/topic_discoverer.rb', line 16

def discover
  @organizations.flat_map do |org|
    query = "topic:#{@topic} org:#{org}"
    results = @client.search_repositories(query)
    results[:items].map do |repo|
      RepoRef.new(owner: org, repo: repo[:name])
    end
  end
end