add skeleton of endpoint to receive github webhooks

This commit is contained in:
burnettk 2022-12-08 23:55:01 -05:00
parent 2ad4da8fb9
commit f38af7f4a4
3 changed files with 30 additions and 1 deletions

View File

@ -490,6 +490,20 @@ paths:
items:
$ref: "#/components/schemas/Process"
/github-webhook-receive:
post:
operationId: spiffworkflow_backend.routes.process_api_blueprint.github_webhook_receive
summary: receives push webhooks from github so we can keep our process model repo up to date
tags:
- git
responses:
"200":
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/OkTrue"
/process-instances:
parameters:
- name: process_model_identifier

View File

@ -1816,9 +1816,20 @@ def get_spiff_task_from_process_instance(
return spiff_task
# sample body:
# {'ref': 'refs/heads/main', 'repository': {'name': 'sample-process-models',
# 'full_name': 'sartography/sample-process-models', 'private': False .... }}
def github_webhook_receive(body: dict) -> Response:
"""Github_webhook_receive."""
print(f"body: {body}")
return Response(json.dumps({"ok": True}), status=200, mimetype="application/json")
#
# Methods for secrets CRUD - maybe move somewhere else:
#
def get_secret(key: str) -> Optional[str]:
"""Get_secret."""
return SecretService.get_secret(key)

View File

@ -232,7 +232,11 @@ class AuthorizationService:
def should_disable_auth_for_request(cls) -> bool:
"""Should_disable_auth_for_request."""
swagger_functions = ["get_json_spec"]
authentication_exclusion_list = ["status", "authentication_callback"]
authentication_exclusion_list = [
"status",
"authentication_callback",
"github_webhook_receive",
]
if request.method == "OPTIONS":
return True