Spaces:
Build error
Build error
fix little issues
Browse files
app.py
CHANGED
|
@@ -93,7 +93,7 @@ async def post_webhook(
|
|
| 93 |
return "Processed"
|
| 94 |
|
| 95 |
|
| 96 |
-
def sync_ci_space(space_id: str, pr_num: int, private
|
| 97 |
# Create a temporary space for CI if didn't exist
|
| 98 |
ci_space_id = _get_ci_space_id(space_id=space_id, pr_num=pr_num)
|
| 99 |
|
|
@@ -121,13 +121,15 @@ def sync_ci_space(space_id: str, pr_num: int, private=bool) -> None:
|
|
| 121 |
)
|
| 122 |
|
| 123 |
# Sync space codebase with PR revision
|
| 124 |
-
operations = [
|
|
|
|
|
|
|
| 125 |
operations += [
|
| 126 |
CommitOperationAdd(
|
| 127 |
path_in_repo=str(filepath.relative_to(snapshot_path)),
|
| 128 |
path_or_fileobj=filepath,
|
| 129 |
)
|
| 130 |
-
for filepath in Path(snapshot_path).glob("
|
| 131 |
if filepath.is_file()
|
| 132 |
]
|
| 133 |
create_commit(
|
|
@@ -179,7 +181,7 @@ def _get_ci_space_id(space_id: str, pr_num: int) -> str:
|
|
| 179 |
|
| 180 |
NOTIFICATION_TEMPLATE_CREATE = """\
|
| 181 |
Hey there!
|
| 182 |
-
Following the creation of this PR, a temporary test Space [{ci_space_id}
|
| 183 |
Any changes pushed to this PR will be synced with the test Space.
|
| 184 |
|
| 185 |
(This is an automated message)
|
|
@@ -187,7 +189,7 @@ Any changes pushed to this PR will be synced with the test Space.
|
|
| 187 |
|
| 188 |
NOTIFICATION_TEMPLATE_UPDATE = """\
|
| 189 |
Hey there!
|
| 190 |
-
Following new commits that happened in this PR, the temporary test Space [{ci_space_id}
|
| 191 |
|
| 192 |
(This is an automated message)
|
| 193 |
"""
|
|
|
|
| 93 |
return "Processed"
|
| 94 |
|
| 95 |
|
| 96 |
+
def sync_ci_space(space_id: str, pr_num: int, private: bool) -> None:
|
| 97 |
# Create a temporary space for CI if didn't exist
|
| 98 |
ci_space_id = _get_ci_space_id(space_id=space_id, pr_num=pr_num)
|
| 99 |
|
|
|
|
| 121 |
)
|
| 122 |
|
| 123 |
# Sync space codebase with PR revision
|
| 124 |
+
operations = [ # little aggressive but works
|
| 125 |
+
CommitOperationDelete(".", is_folder=True)
|
| 126 |
+
]
|
| 127 |
operations += [
|
| 128 |
CommitOperationAdd(
|
| 129 |
path_in_repo=str(filepath.relative_to(snapshot_path)),
|
| 130 |
path_or_fileobj=filepath,
|
| 131 |
)
|
| 132 |
+
for filepath in Path(snapshot_path).glob("**/*")
|
| 133 |
if filepath.is_file()
|
| 134 |
]
|
| 135 |
create_commit(
|
|
|
|
| 181 |
|
| 182 |
NOTIFICATION_TEMPLATE_CREATE = """\
|
| 183 |
Hey there!
|
| 184 |
+
Following the creation of this PR, a temporary test Space [{ci_space_id}](https://huggingface.co/spaces/{ci_space_id}) has been launched.
|
| 185 |
Any changes pushed to this PR will be synced with the test Space.
|
| 186 |
|
| 187 |
(This is an automated message)
|
|
|
|
| 189 |
|
| 190 |
NOTIFICATION_TEMPLATE_UPDATE = """\
|
| 191 |
Hey there!
|
| 192 |
+
Following new commits that happened in this PR, the temporary test Space [{ci_space_id}](https://huggingface.co/spaces/{ci_space_id}) has been updated.
|
| 193 |
|
| 194 |
(This is an automated message)
|
| 195 |
"""
|