@@ -164,14 +164,13 @@ def make_changelog_pr(auth, branch, repo, title, commit_message, body, dry_run=F
164164 # Make a new branch with a uuid suffix
165165 pr_branch = f"changelog-{ uuid .uuid1 ().hex } "
166166
167- if not dry_run :
168- dirty = util .run ("git --no-pager diff --stat" ) != ""
169- if dirty :
170- util .run ("git stash" )
171- util .run (f"{ util .GIT_FETCH_CMD } { branch } " )
172- util .run (f"git checkout -b { pr_branch } origin/{ branch } " )
173- if dirty :
174- util .run ("git stash apply" )
167+ dirty = util .run ("git --no-pager diff --stat" ) != ""
168+ if dirty :
169+ util .run ("git stash" )
170+ util .run (f"{ util .GIT_FETCH_CMD } { branch } " )
171+ util .run (f"git checkout -b { pr_branch } origin/{ branch } " )
172+ if dirty :
173+ util .run ("git stash apply" )
175174
176175 # Add a commit with the message
177176 try :
@@ -188,8 +187,8 @@ def make_changelog_pr(auth, branch, repo, title, commit_message, body, dry_run=F
188187 head = pr_branch
189188 maintainer_can_modify = True
190189
191- if not dry_run :
192- util .run (f"git push origin { pr_branch } " )
190+ remote_name = util . get_remote_name ( dry_run )
191+ util .run (f"git push { remote_name } { pr_branch } " )
193192
194193 # title, head, base, body, maintainer_can_modify, draft, issue
195194 pull = gh .pulls .create (title , head , base , body , maintainer_can_modify , False , None )
@@ -265,9 +264,10 @@ def draft_release(
265264 if delta .days > 0 :
266265 gh .repos .delete_release (release .id )
267266
268- remote_url = util .run ("git config --get remote.origin.url" )
269- if not dry_run and not os .path .exists (remote_url ):
270- util .run (f"git push origin HEAD:{ branch } --follow-tags --tags" )
267+ remote_name = util .get_remote_name (dry_run )
268+ remote_url = util .run (f"git config --get remote.{ remote_name } .url" )
269+ if not os .path .exists (remote_url ):
270+ util .run (f"git push { remote_name } HEAD:{ branch } --follow-tags --tags" )
271271
272272 util .log (f"Creating release for { version } " )
273273 util .log (f"With assets: { assets } " )
0 commit comments