Disable auto-switching to master branch on deletion

I am using multiple static sites for our QA (staging) and Demo (production alike) environment deployment using different git branches.

branch: test => deploys to test.domain.com
branch: demo => deploys to demo.domain.com
branch: master => deploys to prod.domain.com

When new updates get released, test and demo branches gets deleted and are synced with master. During this process, render automatically switches branches for test and demo to the master branch.

Are there any settings available to stop this behaviour ? :pray:

Thank you.

Hi there,

Thanks for reaching out.

There’s no current way to prevent this behavior.

There may be ways to workaround it, most simply, maybe don’t delete the branches when they’re merged with master? You could maybe reset them to master after merging, to get them back in sync.

However, I wouldn’t want you to have to change your workflow, maybe if you have some automation/GitHub actions doing these merge/deletions, you could use the Render API to set the branch back to the desired branch when it is recreated?, e.g.

curl --request PATCH \ --url https://api.render.com/v1/services/<SERVICE_ID> \ --header 'Accept: application/json' \ --header 'Authorization: Bearer <RENDER_API_KEY>' \ --header 'Content-Type: application/json' \ --data '{"branch":"<BRANCH_NAME>"}'

Alternatively, utilising Pull Request Previews might be an option, to keep these other branches within a main static site? If you’re utilising GitHub PRs they would be deleted & created along with the Pull Request. Although, this approach wouldn’t have your custom domains by default.

Please let us know if we can assist any further.


Thank you @al_ps for your help. :pray:

You could maybe reset them to master after merging, to get them back in sync.

I think this will do fine for me. I was just wondering about this default behaviour of auto switching and not-auto-switching if I create the branch again :smiling_face: .

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.