not-lain commited on
Commit
cfd7938
·
1 Parent(s): efb2876

update replies

Browse files
Files changed (1) hide show
  1. src/gradio_space_ci/webhook.py +8 -5
src/gradio_space_ci/webhook.py CHANGED
@@ -358,7 +358,9 @@ def sync_ci_space(space_id: str, pr_num: int, skip_config: bool = False) -> None
358
  readme_path.unlink(missing_ok=True)
359
 
360
  # Post a comment on the PR
361
- if is_new and is_configured:
 
 
362
  notify_pr(space_id=space_id, pr_num=pr_num, action="created_and_configured")
363
  elif is_new:
364
  notify_pr(space_id=space_id, pr_num=pr_num, action="created_not_configured")
@@ -458,9 +460,9 @@ def notify_pr(
458
  elif action == "deleted":
459
  comment = NOTIFICATION_TEMPLATE_DELETED
460
  elif action == "trusted_pr":
461
- comment = NOTIFICATION_TEMPLATE_TRUSTED_PR
462
  elif action == "untrusted_pr":
463
- comment = NOTIFICATION_TEMPLATE_UNTRUSTED_PR
464
  else:
465
  raise ValueError(f"Status {action} not handled.")
466
 
@@ -505,7 +507,6 @@ def handle_command(space_id: str, payload: WebhookPayload) -> None:
505
  notify_pr(space_id=space_id, pr_num=pr_num, action="trusted_pr")
506
  elif payload.comment.content == "/untrust_pr":
507
  rebuild_space(space_id=space_id, pr_num=pr_num)
508
- notify_pr(space_id=space_id, pr_num=pr_num, action="untrusted_pr")
509
 
510
 
511
  NOTIFICATION_TEMPLATE_CREATED_AND_CONFIGURED = """\
@@ -532,12 +533,14 @@ _(This is an automated message.)_
532
 
533
  NOTIFICATION_TEMPLATE_TRUSTED_PR = """\
534
  This PR has been granted temporary trust status Thus granting it with the appropriate approriate hardware, storage, and secrets.
535
- Trust status will be revokeduser either when a trusted author uses `/untrust_pr` command or when new commits are pushed to this PR.
 
536
  _(This is an automated message.)_
537
  """
538
 
539
  NOTIFICATION_TEMPLATE_UNTRUSTED_PR = """\
540
  This PR has been untrusted. Thus resetting all hardware, storage, and secrets.
 
541
  _(This is an automated message.)_
542
  """
543
 
 
358
  readme_path.unlink(missing_ok=True)
359
 
360
  # Post a comment on the PR
361
+ if is_new and skip_config:
362
+ notify_pr(space_id=space_id, pr_num=pr_num, action="untrusted_pr")
363
+ elif is_new and is_configured:
364
  notify_pr(space_id=space_id, pr_num=pr_num, action="created_and_configured")
365
  elif is_new:
366
  notify_pr(space_id=space_id, pr_num=pr_num, action="created_not_configured")
 
460
  elif action == "deleted":
461
  comment = NOTIFICATION_TEMPLATE_DELETED
462
  elif action == "trusted_pr":
463
+ comment = NOTIFICATION_TEMPLATE_TRUSTED_PR.format(ci_space_id=ci_space_id)
464
  elif action == "untrusted_pr":
465
+ comment = NOTIFICATION_TEMPLATE_UNTRUSTED_PR.format(ci_space_id=ci_space_id)
466
  else:
467
  raise ValueError(f"Status {action} not handled.")
468
 
 
507
  notify_pr(space_id=space_id, pr_num=pr_num, action="trusted_pr")
508
  elif payload.comment.content == "/untrust_pr":
509
  rebuild_space(space_id=space_id, pr_num=pr_num)
 
510
 
511
 
512
  NOTIFICATION_TEMPLATE_CREATED_AND_CONFIGURED = """\
 
533
 
534
  NOTIFICATION_TEMPLATE_TRUSTED_PR = """\
535
  This PR has been granted temporary trust status Thus granting it with the appropriate approriate hardware, storage, and secrets.
536
+ You can access the ephemeral Space at [{ci_space_id}](https://huggingface.co/spaces/{ci_space_id}).
537
+ Trust status will be revoked either when a trusted author uses `/untrust_pr` command or when new commits are pushed to this PR.
538
  _(This is an automated message.)_
539
  """
540
 
541
  NOTIFICATION_TEMPLATE_UNTRUSTED_PR = """\
542
  This PR has been untrusted. Thus resetting all hardware, storage, and secrets.
543
+ You can access this PR's ephemeral Space at [{ci_space_id}](https://huggingface.co/spaces/{ci_space_id}).
544
  _(This is an automated message.)_
545
  """
546