mirror of
https://github.com/davidism/modify-repos.git
synced 2025-08-28 12:04:04 +00:00
update existing branch and pr
This commit is contained in:
parent
d7dbd26e42
commit
4dba24283e
2 changed files with 21 additions and 11 deletions
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
Unreleased
|
Unreleased
|
||||||
|
|
||||||
|
- If a PR already exists from a previous failed run, force push to update the
|
||||||
|
existing branch and PR.
|
||||||
|
|
||||||
## Version 0.1.1
|
## Version 0.1.1
|
||||||
|
|
||||||
Released 2025-01-14
|
Released 2025-01-14
|
||||||
|
|
|
@ -66,14 +66,21 @@ class GitHubRepo(GitRepo):
|
||||||
super().submit()
|
super().submit()
|
||||||
return
|
return
|
||||||
|
|
||||||
self.git_cmd("push", "--set-upstream", "origin", self.script.branch)
|
result = self.gh_cmd("pr", "view", "--json", "closed", "--jq", ".closed")
|
||||||
self.gh_cmd(
|
has_pr = not result.returncode and result.stdout.strip() == "false"
|
||||||
"pr",
|
|
||||||
"create",
|
if not has_pr:
|
||||||
"--base",
|
self.git_cmd("push", "--set-upstream", "origin", self.script.branch)
|
||||||
self.script.target,
|
self.gh_cmd(
|
||||||
"--title",
|
"pr",
|
||||||
self.script.title,
|
"create",
|
||||||
"--body",
|
"--base",
|
||||||
self.script.body,
|
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