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.



283
284
285
286
287
288
289
# File 'lib/commenter/github_integration.rb', line 283

def initialize(config_path)
  @config = load_config(config_path)
  @github_client = create_github_client
  @repo = @config.dig("github", "repository")

  raise "GitHub repository not specified in config" unless @repo
end

Instance Method Details

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



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/commenter/github_integration.rb', line 291

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