feat(treescript): Bug 2015581 Add github create branch action#1341
feat(treescript): Bug 2015581 Add github create branch action#1341
Conversation
9b3ef08 to
302b928
Compare
Eijebong
left a comment
There was a problem hiding this comment.
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.
| 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!") |
There was a problem hiding this comment.
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...
65e421a to
0340d98
Compare
| TreeScriptError: If branch_name is not specified in the task. | ||
| """ | ||
| create_branch_info = get_create_branch_info(task) | ||
| if "branch_name" not in create_branch_info: |
There was a problem hiding this comment.
Nit: I don't think this can happen? I'd expect schema validation to fail it early
"create_branch_info": {
"type": "object",
"properties": {
"branch_name": {
"type": "string"
}
},
"required": [
"branch_name"
]
},
There was a problem hiding this comment.
create_branch_info can be None
There was a problem hiding this comment.
But then we have another problem?
>>> "branch_name" not in None
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
"branch_name" not in None
TypeError: argument of type 'NoneType' is not a container or iterable
There was a problem hiding this comment.
Also it can't be None at that point
create_branch_info = task.get("payload", {}).get("create_branch_info")
if not create_branch_info:
raise TaskVerificationError("Requested create branch but no create_branch_info in payload")
0340d98 to
0ca95c6
Compare
No description provided.