How to omit a branch in render.yaml

Hi there I’m looking to omit a branch from my build, in the docs it says:

Services in render.yaml can omit a repo. If a repo is missing, it is assumed to be the repo the YAML file is in. The specified repo must be accessible to you.

You can also omit a branch. Render will use the repo’s default branch if it’s omitted.

How exactly can a branch be omitted? Also are there some docs on this I haven’t found my way to?

I am not sure if I understand the question. Omitting a branch means there will be no branch: ... in your yaml file.

Thanks Stefan, I’ve confused omit with exclude.

I was hoping for something like !master, so all branches but not master. Failing this is there a way to end a task early or act conditionally based on the branch?

Afaik, there’s no functionality like this. I am just a render.com user like you. Even doing some kind of exit 1 based on the RENDER_GIT_BRANCH env var in the start or build script would still count into your bill, I guess.
But having a feature like the one you mentioned could be really useful. You can request it here.

Hi @robstarbuck,

@stefan.luptak is correct. There isn’t currently a functionality that supports this. A possible workaround (which is admittedly a bit clunky) is to set your default branch to something other than master in your dashboard. Then when you want to deploy master you would specify branch: master in your yaml.

1 Like