Skip to content

Commit 0e65483

Browse files
Enable closing pr during re-downloading
1 parent 9d97ccf commit 0e65483

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

app/commands/download.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from app.utils.git import add_all, commit, empty_commit, init
2525
from app.utils.github_cli import (
2626
clone_with_custom_name,
27+
close_pr,
2728
delete_repo,
2829
fork,
2930
get_username,
@@ -49,6 +50,11 @@ def _download_exercise(
4950

5051
if os.path.isdir(exercise):
5152
warn(f"You already have {exercise}, removing it to download again")
53+
old_config = ExerciseConfig.read(Path(exercise), 0)
54+
if old_config.exercise_repo.repo_type == "remote" and old_config.exercise_repo.create_fork:
55+
pr_repo_full_name = old_config.exercise_repo.pr_repo_full_name
56+
if pr_repo_full_name:
57+
close_pr(pr_repo_full_name)
5258
rmtree(exercise)
5359

5460
os.makedirs(exercise)

0 commit comments

Comments
 (0)