mirror of
https://github.com/davidism/modify-repos.git
synced 2025-07-07 19:35:34 +00:00
Merge pull request #5 from davidism/update-pr
update existing branch and pr
This commit is contained in:
commit
3e778fb77e
2 changed files with 21 additions and 11 deletions
|
@ -2,6 +2,9 @@
|
|||
|
||||
Unreleased
|
||||
|
||||
- If a PR already exists from a previous failed run, force push to update the
|
||||
existing branch and PR.
|
||||
|
||||
## Version 0.1.1
|
||||
|
||||
Released 2025-01-14
|
||||
|
|
|
@ -66,14 +66,21 @@ class GitHubRepo(GitRepo):
|
|||
super().submit()
|
||||
return
|
||||
|
||||
self.git_cmd("push", "--set-upstream", "origin", self.script.branch)
|
||||
self.gh_cmd(
|
||||
"pr",
|
||||
"create",
|
||||
"--base",
|
||||
self.script.target,
|
||||
"--title",
|
||||
self.script.title,
|
||||
"--body",
|
||||
self.script.body,
|
||||
)
|
||||
result = self.gh_cmd("pr", "view", "--json", "closed", "--jq", ".closed")
|
||||
has_pr = not result.returncode and result.stdout.strip() == "false"
|
||||
|
||||
if not has_pr:
|
||||
self.git_cmd("push", "--set-upstream", "origin", self.script.branch)
|
||||
self.gh_cmd(
|
||||
"pr",
|
||||
"create",
|
||||
"--base",
|
||||
self.script.target,
|
||||
"--title",
|
||||
self.script.title,
|
||||
"--body",
|
||||
self.script.body,
|
||||
)
|
||||
else:
|
||||
# If open PR already exists from previous run, force push.
|
||||
self.git_cmd("push", "--force", "origin", self.script.branch)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue