Class: Kennel::GithubReporter
- Inherits:
-
Object
- Object
- Kennel::GithubReporter
- Defined in:
- lib/kennel/github_reporter.rb
Instance Method Summary collapse
-
#initialize(token) ⇒ GithubReporter
constructor
A new instance of GithubReporter.
- #report ⇒ Object
Constructor Details
#initialize(token) ⇒ GithubReporter
Returns a new instance of GithubReporter.
4 5 6 7 8 9 |
# File 'lib/kennel/github_reporter.rb', line 4 def initialize(token) @token = token @git_sha = Utils.capture_sh("git rev-parse HEAD").strip origin = ENV["PROJECT_REPOSITORY"] || Utils.capture_sh("git remote -v").split("\n").first @repo_part = origin[%r{github\.com[:/](.+?)(\.git|$)}, 1] || raise("no origin found") end |
Instance Method Details
#report ⇒ Object
11 12 13 14 15 |
# File 'lib/kennel/github_reporter.rb', line 11 def report output = Utils.strip_shell_control(Utils.capture_stdout { yield }.strip) ensure comment "```\n#{output || "Error"}\n```" end |