Sha256: 23c0e55f2dd52a7a4c6602ae53fb1bb70cbda4170bc89d8468f9457f68a3c466
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require 'chatwork' module Danger class DangerChatwork < Plugin # API token to authenticate with ChatWork API # # @return [String] attr_writer :api_token def initialize(dangerfile) super(dangerfile) self.api_token = ENV['CHATWORK_API_TOKEN'] end def notify(room_id:, text: '') return ChatWork::Message.create(room_id: room_id, body: text) unless text.empty? return if reports.empty? report = "[info][title]Danger Report[/title]#{pr_info}\n#{reports.join("\n")}[/info]" ChatWork::Message.create(room_id: room_id, body: report) end def api_token=(value) ChatWork.api_key = value end private def reports status_report.reject { |_, v| v.empty? }.map do |status, messages| messages = messages.map(&:message) if status == :markdowns <<-REPORT #{status.to_s} - #{messages.join("\n - ")} REPORT end end def pr_info # TODO: GitHub(Enterprise)以外のPR情報取得 github = @dangerfile.github <<-INFO #{github.pr_title} ##{github.pr_json['number']} #{github.pr_json['html_url']} INFO end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
danger-chatwork-0.0.1 | lib/chatwork/plugin.rb |