Class: Browsable::Formatters::Github
- Inherits:
-
Object
- Object
- Browsable::Formatters::Github
- Defined in:
- lib/browsable/formatters/github.rb
Overview
Emits GitHub Actions workflow commands so findings surface as inline annotations on a pull request. See: docs.github.com/actions/reference/workflow-commands-for-github-actions
Constant Summary collapse
- LEVELS =
{ error: "error", warning: "warning", info: "notice" }.freeze
Instance Method Summary collapse
-
#initialize(report) ⇒ Github
constructor
A new instance of Github.
- #render ⇒ Object
Constructor Details
#initialize(report) ⇒ Github
Returns a new instance of Github.
11 12 13 |
# File 'lib/browsable/formatters/github.rb', line 11 def initialize(report) @report = report end |
Instance Method Details
#render ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/browsable/formatters/github.rb', line 15 def render lines = @report.findings.map { |finding| annotation(finding) } if (suggestion = @report.suggestion) lines << "::notice title=#{escape_property('browsable: suggested allow_browser')}::" \ "#{escape_data(suggestion.line)}" end lines.join("\n") end |