not-lain commited on
Commit
f520416
·
1 Parent(s): 70bfd6c
Files changed (1) hide show
  1. src/gradio_space_ci/webhook.py +12 -1
src/gradio_space_ci/webhook.py CHANGED
@@ -283,7 +283,18 @@ async def trigger_ci_on_pr(payload: WebhookPayload, task_queue: BackgroundTasks)
283
  # Found a PR that is not yet synced
284
  task_queue.add_task(sync_ci_space, space_id=space_id, pr_num=discussion.num)
285
  has_task = True
286
-
 
 
 
 
 
 
 
 
 
 
 
287
  if has_task:
288
  return Response("Task scheduled to sync/delete Space", status_code=status.HTTP_202_ACCEPTED)
289
  else:
 
283
  # Found a PR that is not yet synced
284
  task_queue.add_task(sync_ci_space, space_id=space_id, pr_num=discussion.num)
285
  has_task = True
286
+ elif (
287
+ # Comment on an open pr by trusted_authors
288
+ payload.event.scope == "discussion.comment"
289
+ and payload.event.action == "create"
290
+ and payload.discussion.isPullRequest
291
+ and payload.discussion.status == "open"
292
+ # TODO:
293
+ # this is limited to the owner only switch to trusted_authors
294
+ and payload.discussion.author.id == payload.repo.owner
295
+ ):
296
+ print("Payload by owner detected with content:\n ", payload.comment.content)
297
+
298
  if has_task:
299
  return Response("Task scheduled to sync/delete Space", status_code=status.HTTP_202_ACCEPTED)
300
  else: