Skip to content

Conversation

@hneiva
Copy link
Contributor

@hneiva hneiva commented Feb 9, 2026

No description provided.

@hneiva hneiva requested a review from a team as a code owner February 9, 2026 19:06
@hneiva hneiva marked this pull request as draft February 9, 2026 19:07
@hneiva hneiva force-pushed the hneiva/ios-merge-automation branch from 133c7fa to 9b3ef08 Compare February 9, 2026 20:57
@hneiva hneiva force-pushed the hneiva/ios-merge-automation branch from 9b3ef08 to 302b928 Compare February 9, 2026 21:01
@hneiva hneiva requested a review from Eijebong February 9, 2026 21:05
@hneiva hneiva marked this pull request as ready for review February 9, 2026 21:13
Copy link
Contributor

@Eijebong Eijebong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bunch of minor things. Also I would've preferred if this had been split in 2 commits (I'm not even sure submitting the whole thing was intentional), the version bump in xcconfig and the branch creation since they're completely unrelated in code. Neither the commit nor the bug even mentions that version bump semantic change.

lines = [line for line in contents.splitlines() if line and not line.startswith("#")]
else:
# version.xcconfig files should only have a single line with APP_VERSION = 111
lines = [line.lstrip("APP_VERSION = ") for line in contents.splitlines()]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lstrip here works kinda by miracle and the fact that we don't use any of these characters in the version name. removeprefix would be much more appropriate

}

verb = "Would create" if dry_run else "Creating"
log.debug(f"{verb} {branch_name} on repo {repo}[{repo_id}] at {source_branch}@{source_oid}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.debug(f"{verb} {branch_name} on repo {repo}[{repo_id}] at {source_branch}@{source_oid}")
log.debug(f"{verb} {branch_name} on repo {self.repo}[{repo_id}] at {source_branch}@{source_oid}")

Otherwise you're logging the full response from graphql?

"""Create a new branch in the repository.

Args:
branch (str): The name of the new branch to create.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
branch (str): The name of the new branch to create.
branch_name (str): The name of the new branch to create.

Args:
branch (str): The name of the new branch to create.
from_branch (str): The branch to create the new branch from. Uses the
repository's default branch if unspecified (optional).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docs on dry_run, not that it really needs any but that's inconsistent

return version_info


# get_version_bump_info {{{1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 wrong copy/paste

from treescript.util.task import get_branch, get_create_branch_info, should_push


def get_branch_name(task: Dict) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def get_branch_name(task: Dict) -> str:
def get_branch_name(task: Dict) -> Optional[str]:

Don't think it can be None but then you should use ["branch_name"]. We don't use anything to actually read those type annotations but if we ever do it'd be nice to not have to fix this



def get_branch_name(task: Dict) -> str:
"""Get the source branch name from a task's create_branch_info.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the opposite of what this function does isn't it? It's the target branch name, not the source? IMO worth renaming the function to get_target_branch_name also to clear out the confusion with get_branch

task (Dict): The task definition containing create_branch_info.

Returns:
str: The name of the branch to create from, or None if not specified.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this says the opposite of what it does

repo = (await self._client.execute(str_info_query))["repository"]

if repo.get("object") is None:
raise UnknownBranchError(f"branch '{source_branch}' not found in repo!")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should also check if the branch already exists and bail early? I'm seeing the "branch creation passed but version bump got 500s" already...

Although there's an argument for saying that if the branch already exists it could've been created by mistake by a human and shouldn't be used and thus failing here is the right thing to do...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants