Class: Commenter::GitHubIssueRetriever

Inherits:
Object
  • Object
show all
Defined in:
lib/commenter/github_integration.rb

Instance Method Summary collapse

Constructor Details

#initialize(config_path) ⇒ GitHubIssueRetriever

Returns a new instance of GitHubIssueRetriever.



299
300
301
302
303
304
# File 'lib/commenter/github_integration.rb', line 299

def initialize(config_path)
  @session = GitHubSession.new(config_path)
  @config = @session.config
  @github_client = @session.client
  @repo = @session.repo
end

Instance Method Details

#retrieve_observations_from_yaml(yaml_file, options = {}) ⇒ Object



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/commenter/github_integration.rb', line 306

def retrieve_observations_from_yaml(yaml_file, options = {})
  data = YAML.load_file(yaml_file)
  comment_sheet = CommentSheet.from_hash(data)

  results = []
  comment_sheet.comments.each do |comment|
    next unless comment.has_github_issue?

    result = if options[:dry_run]
               preview_observation_retrieval(comment, options)
             else
               retrieve_observation(comment, options)
             end
    results << result
  end

  # Update YAML with observations (unless dry run)
  update_yaml_with_observations(yaml_file, comment_sheet, options) unless options[:dry_run]

  results
end