Support alternate target branch
The `repo.branch` configuration setting controls the branch of the repote repository to check out. It is also used as the target branch name for the Gitea pull request.master
parent
d19481b063
commit
22a9b26619
|
@ -158,6 +158,7 @@ Project = Union[
|
|||
class RepoConfig(pydantic.BaseModel):
|
||||
url: str
|
||||
token_file: Path
|
||||
branch: str = 'master'
|
||||
|
||||
@functools.cached_property
|
||||
def repo_api_url(self) -> str:
|
||||
|
@ -300,7 +301,7 @@ def main() -> None:
|
|||
d = Path(d)
|
||||
log.debug('Retreiving repository Git URL')
|
||||
repo_url = config.repo.get_git_url()
|
||||
repo = git.Repo.clone_from(repo_url, d, depth=1)
|
||||
repo = git.Repo.clone_from(repo_url, d, depth=1, b=config.repo.branch)
|
||||
log.debug('Checking out new branch: %s', args.branch_name)
|
||||
repo.heads[0].checkout(force=True, B=args.branch_name)
|
||||
title = None
|
||||
|
@ -321,7 +322,7 @@ def main() -> None:
|
|||
)
|
||||
)
|
||||
repo.remote().push(force=True)
|
||||
config.repo.create_pr(title, args.branch_name, 'master')
|
||||
config.repo.create_pr(title, args.branch_name, config.repo.branch)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue