Skip to content

Latest commit

 

History

History

03_webhook_that_lambda

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Step 3 Make lambda serve as a github webhook

You've now got a lambda that responds to http requests. It's time to send those requests to github. Your lambda's job is to find the last comment when an issue is closed.

Stick a Fork in it

Hook it up

  • Enable issues ⚙️ Settings -> (scroll down) Features -> ☑️ Issues (only necessary for forks, regular repos get them enabled by default)
  • Once you have your fork click on ⚙️ Settings -> Webhooks -> Add webhook (re-enter your github password)
  • For Payload URL enter your Lambda Invoke URL
  • Change content type to application/json
  • Select "Let me select individual events" select Issues and unselect Push then Add webhook to save it
  • Github will immediately POST a message to your webhook. You can see it on the details for that webhook under "Recent Deliveries". There you can see the the payload github sent and the response it received.

Make webhook useful

  • The goal in this section is to find the last comment when an issue is closed
  • On your repo create an issue, add a comment, and close it
  • Go back to your "Recent Deliveries" for your webhook and look at the payloads
  • The requests have links to everything you need to find out about the issue. Follow those links to get the information you want
  • Providing links to navigate an API like this is a pattern called HATEOAS
  • You will have to zip up your webhook folder and upload it multiple times
  • Example code in github-webhook-lambda

Now proceed to step 4