Created
December 8, 2018 16:36
-
-
Save EtienneDepaulis/231fd20e52c89fbdc7aea1a57db1d5f6 to your computer and use it in GitHub Desktop.
CircleCi notifications article - Main code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# circleci-notifications.rb | |
require 'json' | |
def handler(event:, context:) | |
body = JSON.parse(event['body']) | |
payload = body['payload'] | |
if payload['failed'] | |
message = 'Failure detected' | |
else | |
message = 'No failure detected' | |
end | |
{ statusCode: 200, body: JSON.generate({ message: message }) } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment