Enable closing pr during resetting and re-downloading#75
Enable closing pr during resetting and re-downloading#75desmondwong1215 wants to merge 7 commits intogit-mastery:mainfrom
Conversation
ef9067d to
d367eb4
Compare
bbd5bc3 to
82b5422
Compare
| [ | ||
| "gh", | ||
| "pr", | ||
| "list", | ||
| "--repo", | ||
| repo, | ||
| "--author", | ||
| username, | ||
| "--state", | ||
| "open", | ||
| "--json", | ||
| "number", | ||
| "--jq", | ||
| ".[].number", | ||
| ], |
There was a problem hiding this comment.
This only fetches the first 30 PRs, and while technically the better option would be to add a flag of the form --limit 9999999 for edge cases, it is extremely unlikely the user will ever open >30 PRs on their repo (unless done deliberately). So it may be fine to leave it this way.
There was a problem hiding this comment.
Pull request overview
Adds support for automatically closing a user’s open pull requests during exercise reset and re-download workflows, using GitHub CLI, and persists PR-related metadata in the exercise config to drive that behavior.
Changes:
- Introduce
close_pr()helper inapp/utils/github_cli.pyto close all open PRs authored by the current user in a given repo. - Extend
ExerciseRepoConfigto includepr_numberandpr_repo_full_name, and read them from.gitmastery-exercise.json. - Invoke PR-closing during
progress resetand when re-downloading over an existing exercise directory.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| app/utils/github_cli.py | Adds GH CLI helper to list and close open PRs authored by the user. |
| app/configs/exercise_config.py | Adds PR metadata fields to exercise repo config and reads them from JSON. |
| app/commands/progress/reset.py | Closes open PRs (when configured) before deleting the fork during reset. |
| app/commands/download.py | Attempts to close PRs from a prior exercise config when re-downloading over an existing directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
82b5422 to
dc6b6ee
Compare
All open pr by the user will be closed during resetting and re-downloading.