Class: DangerPrComment::Reporter
- Inherits:
-
Object
- Object
- DangerPrComment::Reporter
- Defined in:
- lib/danger-pr-comment/reporter.rb
Instance Method Summary collapse
- #export_json(report_path, event_path) ⇒ Object
-
#initialize(status_report) ⇒ Reporter
constructor
A new instance of Reporter.
Constructor Details
#initialize(status_report) ⇒ Reporter
7 8 9 |
# File 'lib/danger-pr-comment/reporter.rb', line 7 def initialize(status_report) @status_report = status_report end |
Instance Method Details
#export_json(report_path, event_path) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/danger-pr-comment/reporter.rb', line 11 def export_json(report_path, event_path) return unless report_path && event_path && File.exist?(event_path) event = JSON.parse(File.read(event_path)) pr_number = event.dig('pull_request', 'number') return unless pr_number report = build_report(pr_number) File.write(report_path, JSON.pretty_generate(report)) end |