Skip to content

clsOrg/platform-samples

 
 

Repository files navigation

GitHub API Challenge

This is simple web service that receives a wehook on repository event. When a webhook is triggered for a deleted repository, this web service will create a new issue in the cls_notification repository and that notifies chadlsmith that the issue has been created.

Prerequisites

Configuration

Before running the sample, you will need to start the following services on your machine.

Ngrok

To start ngrok run the following command

<ngrok_download_dir>/ngrok http 4567

When ngrok starts take note of the forwarding ip address it will be similar to:

Forwarding                    http://4554ee82.ngrok.io -> localhost:4567

Clone repository

To pull the most recent version of the sample run a git clone on the clsOrg/platform-samples repository

git clone https://github.com/clsOrg/platform-samples.git

Start Application

To setup the environment to connect to your GitHub Org you will need to update the set.env file with your api key and execute the set.env file using the following command:

. ./<sample_install_dir>/platform-samples/hooks/ruby/delete-repository-event/set.env

To start the the samples run the following command:

ruby <sample_install_dir>/platform-samples/hooks/ruby/delete-repository-event/app.rb

Running the test

Validating the test

Go to https://github.com/clsOrg/cls_notification to validate that a new issue has been created. It should be smiilar to example below.

[Restore the repository](https://github.com/stafftools/users/clsOrg/purgatory)
 @chadlsmith Please review this isue
```json
{
  "action": "deleted",
  "repository": {
    "id": 101403334,
    "name": "tets1",
    "full_name": "clsOrg/tets1",
    "owner": {
      "login": "clsOrg",
      "id": 31157515,
...

Debugging

If your issue was not created you can debug using the following steps:

  • Was the webhook created?
  • Did ngrok recognize the webhook?
    • In the ngrok console you should see a new HTTP request
       HTTP Requests
       -------------
      
       POST /delete-repository-event  201 Created
      
  • Did the the application event fire?
    127.0.0.1 - - [25/Aug/2017:04:48:31 UTC] "POST /delete-repository-event HTTP/1.1" 500 0
    

Built With

The example is based on the platform samples provided on github.com

About

A public place for all platform sample projects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 32.4%
  • JavaScript 26.0%
  • Scala 9.9%
  • Groovy 9.7%
  • Shell 9.2%
  • HTML 8.5%
  • Other 4.3%