Inconsistent conditional based on build context in Starlark


I am experimenting with Starlark to implement a conditional around whether the build event is a push or a pull request and what branches are involved.

I have the following in the pipeline code:

if == "pull_request":

if in ["master"] or"release"):

return "develop

In case of a pull request the result of this condition is inconsistent.

I have a pull request open from a feature branch (feature/) into an epic branch (epic/).

I would expect the above condition to return since the event is a pull request and that the return value should be the epic branch since that is the target.

Restarting the same build which was kicked off by said pull request the condition above sometimes returns the source branch which seems quite impossible to me, unless the property stores the source branch rather than the target.

In other cases it just falls through and returns the fallback develop value which makes me believe that the build event is wrongly contains push.

May I ask the community’s help in confirming that my condition is valid and should work?

Any help in debugging this situation would be greatly appreciated.

you can view source at