Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Don't send empty Slack messages
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterHattyar committed Mar 6, 2024
1 parent 7285c4f commit ed8912e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
2 changes: 1 addition & 1 deletion lib/version_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def print_version_discrepancies
puts "team: #{team}\n#{message}"

poster = Slack::Poster.new(ENV["SLACK_WEBHOOK"], slack_options(team))
poster.send_message(message.to_s) unless message.nil?
poster.send_message(message.to_s) unless message.empty?
end
end

Expand Down
15 changes: 0 additions & 15 deletions spec/version_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
end

it "detects when there are no files changed since the last release that are built into the gem" do
stub_slack_poster_call_with_no_changes
stub_devdocs_call
stub_rubygems_call("1.2.3")
stub_files_changed_since_tag(["README.md"])
Expand Down Expand Up @@ -65,18 +64,4 @@ def stub_slack_poster_call_with_changes
)
.to_return(status: 200)
end

def stub_slack_poster_call_with_no_changes
stub_request(:post, "https://slack/webhook")
.with(
body: { "payload" => "{\"icon_emoji\":\":gem:\",\"username\":\"Gem Release Bot\",\"channel\":\"#platform-security-reliability-team\",\"text\":\"\"}" },
headers: {
"Accept" => "*/*",
"Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3",
"Content-Type" => "application/x-www-form-urlencoded",
"User-Agent" => "Faraday v2.7.11",
},
)
.to_return(status: 200, body: "", headers: {})
end
end

0 comments on commit ed8912e

Please sign in to comment.