Skip to content

Instantly share code, notes, and snippets.

@EtienneDepaulis
Created December 8, 2018 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EtienneDepaulis/231fd20e52c89fbdc7aea1a57db1d5f6 to your computer and use it in GitHub Desktop.
Save EtienneDepaulis/231fd20e52c89fbdc7aea1a57db1d5f6 to your computer and use it in GitHub Desktop.
CircleCi notifications article - Main code
# 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