Sha256: 5b3978ac660d2bdcb258563249f1914fdfe32faed50821fcec35c82daaae23eb

Contents?: true

Size: 1.57 KB

Versions: 10

Compression:

Stored size: 1.57 KB

Contents

Houston.config do
  on "github:comment: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: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: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

10 entries across 10 versions & 1 rubygems

Version Path
houston-core-0.6.3 templates/new-instance/config/triggers/github/publish_comments_on_slack.rb
houston-core-0.6.2 templates/new-instance/config/triggers/github/publish_comments_on_slack.rb
houston-core-0.6.1 templates/new-instance/config/triggers/github/publish_comments_on_slack.rb
houston-core-0.6.0 templates/new-instance/config/triggers/github/publish_comments_on_slack.rb
houston-core-0.5.6 templates/new-instance/config/triggers/github/publish_comments_on_slack.rb
houston-core-0.5.5 templates/new-instance/config/triggers/github/publish_comments_on_slack.rb
houston-core-0.5.4 templates/new-instance/config/triggers/github/publish_comments_on_slack.rb
houston-core-0.5.3 templates/new-instance/config/triggers/github/publish_comments_on_slack.rb
houston-core-0.5.2 templates/new-instance/config/triggers/github/publish_comments_on_slack.rb
houston-core-0.5.1 templates/new-instance/config/triggers/github/publish_comments_on_slack.rb