fix(git): configure push remote for auto branches
This commit is contained in:
@@ -23,7 +23,7 @@ state = SharedStateHolderInMemory(unmerge=unmerge)
|
||||
checkoutMerged = CheckoutMerged(
|
||||
clone,
|
||||
desired_branches=state,
|
||||
push=True,
|
||||
push="gitea_hermes",
|
||||
git_user_email="rudolfss13@gmail.com",
|
||||
git_user_name="brencher_bot",
|
||||
)
|
||||
|
||||
@@ -189,7 +189,7 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]):
|
||||
desired_branches: AbstractStep[SharedState],
|
||||
git_user_email: str,
|
||||
git_user_name: str,
|
||||
push: bool = True,
|
||||
push: bool | str = True,
|
||||
**kwargs: Any):
|
||||
super().__init__(**kwargs)
|
||||
self.wd = wd
|
||||
@@ -315,9 +315,10 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]):
|
||||
if self.push:
|
||||
auto_branch_hash = hashlib.sha1(''.join([x.hexsha for x in sorted_commits]).encode()).hexdigest()
|
||||
auto_branch_name = f"auto-{version}"
|
||||
push_remote = self.push if isinstance(self.push, str) else "origin"
|
||||
|
||||
logger.info(f"Pushing {repo.head.commit.hexsha} -> {auto_branch_name}")
|
||||
repo.git.push('-f', 'origin', f"HEAD:refs/heads/{auto_branch_name}")
|
||||
repo.git.push('-f', push_remote, f"HEAD:refs/heads/{auto_branch_name}")
|
||||
remote_branch_name = auto_branch_name
|
||||
|
||||
return CheckoutAndMergeResult(
|
||||
|
||||
Reference in New Issue
Block a user