Use octokitpy-routes webhook event names

Fixes #91
This commit is contained in:
Kyle Hornberg
2020-04-13 15:13:23 -05:00
parent ad6abe85f1
commit 858d4c0b7f
3 changed files with 7 additions and 131 deletions
+5 -6
View File
@@ -98,6 +98,9 @@ Webhooks::
return_app_id
boolean; whether or not you want to return the app id from the ping event for GitHub applications. This will only return the ``id`` if the event is the ``ping`` event. Otherwise the return value will be boolean.
Note that webhook names are available at :code:`from octokit_routes import webhook_names`
Authentication
--------------
@@ -150,13 +153,8 @@ GitHub APIs
Data
----
The :code:`octokit` client based on the available `route data <https://github.com/khornberg/octokitpy-routes>`_ and `webhook data <https://github.com/octokit/webhooks.js/blob/master/lib/webhook-names.json>`_
The :code:`octokit` client based on the available `route data <https://github.com/khornberg/octokitpy-routes>`_ and `webhook data <https://github.com/khornberg/octokitpy-routes>`_
::
[x] Periodically, check if ``routes.json`` has changed and if so fetch and open a PR for it to be merged
[ ] Periodically, check if ``webhook-names.json`` has changed and if so fetch and open a PR for it to be merged
Tests
-----
@@ -204,6 +202,7 @@ Deployment
::
[x] Deploy wheels
[x] Make GitHub releases work
-121
View File
@@ -1,121 +0,0 @@
[
"*",
"error",
"commit_comment",
"commit_comment.created",
"create",
"delete",
"deployment",
"deployment_status",
"fork",
"gollum",
"installation",
"installation_repositories",
"installation_repositories.added",
"installation_repositories.removed",
"installation.created",
"installation.deleted",
"issue_comment",
"issue_comment.created",
"issue_comment.deleted",
"issue_comment.edited",
"issues",
"issues.assigned",
"issues.closed",
"issues.demilestoned",
"issues.edited",
"issues.labeled",
"issues.milestoned",
"issues.opened",
"issues.reopened",
"issues.unassigned",
"issues.unlabeled",
"label",
"label.created",
"label.deleted",
"label.edited",
"marketplace_purchase",
"marketplace_purchase.cancelled",
"marketplace_purchase.changed",
"marketplace_purchase.purchased",
"member",
"member.added",
"member.deleted",
"member.edited",
"membership",
"membership.added",
"membership.removed",
"milestone",
"milestone.closed",
"milestone.created",
"milestone.deleted",
"milestone.edited",
"milestone.opened",
"org_block",
"org_block.blocked",
"org_block.unblocked",
"organization",
"organization.member_added",
"organization.member_invited",
"organization.member_removed",
"page_build",
"ping",
"project",
"project_card",
"project_card.closed",
"project_card.created",
"project_card.deleted",
"project_card.edited",
"project_card.reopened",
"project_column",
"project_column.created",
"project_column.deleted",
"project_column.edited",
"project_column.moved",
"project.converted",
"project.created",
"project.deleted",
"project.edited",
"project.moved",
"public",
"pull_request",
"pull_request_review",
"pull_request_review_comment",
"pull_request_review_comment.created",
"pull_request_review_comment.deleted",
"pull_request_review_comment.edited",
"pull_request_review.dismissed",
"pull_request_review.edited",
"pull_request_review.submitted",
"pull_request.assigned",
"pull_request.closed",
"pull_request.edited",
"pull_request.labeled",
"pull_request.opened",
"pull_request.reopened",
"pull_request.review_request_removed",
"pull_request.review_requested",
"pull_request.synchronize",
"pull_request.unassigned",
"pull_request.unlabeled",
"push",
"release",
"release.published",
"repository",
"repository.archived",
"repository.created",
"repository.deleted",
"repository.privatized",
"repository.publicized",
"repository.unarchived",
"status",
"team",
"team_add",
"team.added_to_repository",
"team.created",
"team.deleted",
"team.edited",
"team.removed_from_repository",
"watch",
"watch.started"
]
+2 -4
View File
@@ -3,7 +3,7 @@ import hmac
import json
from uuid import UUID
from octokit import utils
from octokit_routes import webhook_names
def valid_signature(headers, payload, secret):
@@ -23,9 +23,7 @@ def valid_guid(guid):
def valid_event(event, events):
return event in utils.get_json_data("events.json") and (
event in events or "*" in events
)
return event in webhook_names or "*" in webhook_names
def valid_user_agent(ua):