Skip to content

Commit

Permalink
Merge pull request #529 from alphagov/slack-errors
Browse files Browse the repository at this point in the history
Alert PSR slack channel when the Seal fails
  • Loading branch information
MuriloDalRi authored May 13, 2024
2 parents 74724c9 + 0268843 commit 9bc003b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/message_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,22 @@ def build
end
rescue StandardError => e
puts "Error building message: #{e.message}"
alert_slack(e.message)
nil
end

def alert_slack(message)
slack_options =
{
icon_emoji: ":sad-seal:",
username: "Seal error",
channel: "#govuk-platform-security-reliability-team",
}

poster = Slack::Poster.new(ENV["SLACK_WEBHOOK"].to_s, slack_options)
poster.send_message("The Seal has encountered an error running in mode #{@mode}: #{message}")
end

def rotten?(pull_request)
age_in_weekdays = (pr_date(pull_request)...Date.today)
.reject { |d| d.saturday? || d.sunday? }
Expand Down

0 comments on commit 9bc003b

Please sign in to comment.