not-lain commited on
Commit
c051b06
·
1 Parent(s): 2e18413

fix for pr update

Browse files
Files changed (1) hide show
  1. src/gradio_space_ci/webhook.py +2 -1
src/gradio_space_ci/webhook.py CHANGED
@@ -299,7 +299,8 @@ async def trigger_ci_on_pr(payload: WebhookPayload, task_queue: BackgroundTasks)
299
  for discussion in get_repo_discussions(repo_id=space_id, repo_type="space"):
300
  if discussion.is_pull_request and discussion.status == "open":
301
  # Was the pr updated by an untrusted author ?
302
- event_author = discussion._event["author"]["name"] # username of that event
 
303
  if event_author not in EPHEMERAL_SPACES_CONFIG["trusted_authors"]:
304
  # Untrusted author, we unset the config as part or security reasons
305
  unset_config(space_id=space_id, pr_num=discussion.num)
 
299
  for discussion in get_repo_discussions(repo_id=space_id, repo_type="space"):
300
  if discussion.is_pull_request and discussion.status == "open":
301
  # Was the pr updated by an untrusted author ?
302
+ details = get_discussion_details(repo_id=space_id, repo_type="space", discussion_num=pr_num)
303
+ event_author = details.events[-1]._event["author"]["name"] # username of that event
304
  if event_author not in EPHEMERAL_SPACES_CONFIG["trusted_authors"]:
305
  # Untrusted author, we unset the config as part or security reasons
306
  unset_config(space_id=space_id, pr_num=discussion.num)