`delete_branch_on_merge` modifications not being honored

I am trying to, via a GitHub App token with read+write administration permissions, to update the delete_branch_on_merge value for a repository. The request completes successfully, but no matter what value I specify the default_branch_on_merge value for the repository will always be false. This occurs even if a 1) manually set the value to true via the UI, and then 2) run my application code.

In short, the update-repository API doesn’t seem to respect the delete_branch_on_merge for GitHub App requests, and is just silently ignoring it.

I came across your post when trying to troubleshoot the same exact issue. However, we happen to be using an Enterprise instance of GitHub. Are you trying to do this on public GitHub or on an Enterprise instance? Because what I learned was that while the option was available on repos in an earlier release, it wasn’t until Enterprise version 2.21.0 that the enterprise API started supporting updating this value. (https://enterprise.github.com/releases/2.21.0/notes)

Just thought I’d see if that is maybe your issue. If you’re trying to do this on public GitHub then I don’t have a good answer :slight_smile:

Good luck!

1 Like

Thanks. This is in fact a public repository on github.com.

1 Like

I have the same problem with GH EE 2.21.3. Whenever I set delete_branch_on_merge parameter it it completely ignored.

I’m using the API via @octokit/rest + @octokit/plugin-enterprise-server.js from a GitHub App. I tried different preview headers as well with no luck.

Is this API actually available for GitHub Apps? Or do I something wrong?