Sha256: dd627200969906974231ef865e4cd4354fba0e217d7c1b4a95345370c22b88d9

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

Houston.config do
  on "github:comment:created:commit" do |comment|
    channel = "##{comment["project"].slug}" if comment["project"]
    channel = "developers" unless Houston::Slack.connection.channels.include? channel
    body, url = comment.values_at "body", "html_url"

    message = "#{comment["user"]["login"]} commented on #{slack_link_to(comment["commit_id"][0...7], url)}"

    comment = { fallback: body, text: body }
    slack_send_message_to message, channel, as: :github, attachments: [comment], test: true
  end

  on "github:comment:created:diff" do |comment|
    channel = "##{comment["project"].slug}" if comment["project"]
    channel = "developers" unless Houston::Slack.connection.channels.include? channel
    body, url = comment.values_at "body", "html_url"

    message = "#{comment["user"]["login"]} commented on #{slack_link_to(comment["path"], url)}"
    message << "\n```\n#{comment["diff_hunk"]}\n```\n"

    comment = { fallback: body, text: body }
    slack_send_message_to message, channel, as: :github, attachments: [comment], test: true
  end

  on "github:comment:created:pull" do |comment|
    channel = "##{comment["project"].slug}" if comment["project"]
    channel = "developers" unless Houston::Slack.connection.channels.include? channel
    body, url = comment.values_at "body", "html_url"

    issue = comment["issue"]
    message = "#{comment["user"]["login"]} commented on #{slack_link_to("##{issue["number"]} #{issue["title"]}", url)}"

    comment = { fallback: body, text: body }
    slack_send_message_to message, channel, as: :github, attachments: [comment], test: true
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
houston-core-0.7.0.beta3 templates/new-instance/config/triggers/github/publish_comments_on_slack.rb
houston-core-0.7.0.beta2 templates/new-instance/config/triggers/github/publish_comments_on_slack.rb
houston-core-0.7.0.beta templates/new-instance/config/triggers/github/publish_comments_on_slack.rb