gemfarmer / content-linter

A houndci-like tool to keep your content consistent
1 stars 0 forks source link

Support other webhook events #11

Open gemfarmer opened 7 years ago

gemfarmer commented 7 years ago

In order for this app to be viable, it will need to support additional webhook events, namely push and pull_request_review.

Currently, the app works if there is only one error (one comment) and it is on a pull_request event. This PR demonstrates that.

If there is a follow up push event nothing will happen.

If there is more than 1 error, the CF logs will read roughly as follows:

2017-03-06T11:37:43.47-0600 [RTR/1]      OUT content-linter.app.cloud.gov - [2017-03-06T17:37:38.476+0000] "POST /github_webhooks HTTP/1.1" 500 28624 1477 "-" "GitHub-Hookshot/6b02022" "127.0.0.1:61338" "10.10.4.12:61376" x_forwarded_for:"192.30.252.41" x_forwarded_proto:"https" vcap_request_id:"47f85ad9-d95d-4e1f-659b-a38babb5c7dc" response_time:4.998956126 app_id:"da8fd063-82ee-4009-94ee-5d4e997d0ec2" app_index:"0"
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT I, [2017-03-06T17:37:43.524357 #8]  INFO -- : [6ed05960-6132-4a65-80a6-174900658eb0] Completed 500 Internal Server Error in 4975ms
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT F, [2017-03-06T17:37:43.525231 #8] FATAL -- : [6ed05960-6132-4a65-80a6-174900658eb0]   
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT F, [2017-03-06T17:37:43.525301 #8] FATAL -- : [6ed05960-6132-4a65-80a6-174900658eb0] Octokit::UnprocessableEntity (POST https://api.github.com/repos/gemfarmer/github_webhook/pulls/50/comments: 422 - Validation Failed
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT Error summary:
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT   resource: PullRequestReviewComment
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT   code: invalid
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT   field: position // See: https://developer.github.com/v3/pulls/comments/#create-a-comment):
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT F, [2017-03-06T17:37:43.525367 #8] FATAL -- : [6ed05960-6132-4a65-80a6-174900658eb0]   
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT F, [2017-03-06T17:37:43.525436 #8] FATAL -- : [6ed05960-6132-4a65-80a6-174900658eb0] app/controllers/github_webhooks_controller.rb:101:in `create_pull_request_comment'
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT [6ed05960-6132-4a65-80a6-174900658eb0] app/controllers/github_webhooks_controller.rb:54:in `block (2 levels) in github_pull_request'
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT [6ed05960-6132-4a65-80a6-174900658eb0] app/controllers/github_webhooks_controller.rb:48:in `each'
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT [6ed05960-6132-4a65-80a6-174900658eb0] app/controllers/github_webhooks_controller.rb:48:in `block in github_pull_request'
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT [6ed05960-6132-4a65-80a6-174900658eb0] app/controllers/github_webhooks_controller.rb:43:in `each'
2017-03-06T11:37:43.52-0600 [APP/PROC/WEB/0]OUT [6ed05960-6132-4a65-80a6-174900658eb0] app/controllers/github_webhooks_controller.rb:43:in `github_pull_request'