Enable auto merge for repository via API v3

I can see from the API documentation how to update a repository’s settings including allowing merge commits or enabling automatic deletion of branches. However, I can’t see an option to enable the new (beta) auto merge feature.

Am I missing something? If not, are there any plans to add such an option>

Thanks :grinning:

13 Likes

There is now a boolean parameter for auto_merge

https://docs.github.com/en/rest/reference/repos#failed-commit-status-checks

1 Like

That auto_merge looks like the Deployment setting that’s existed for a while. That triggers a merge of the base branch into the topic branch when creating a Deployment. That’s handy, but distinct from the newer auto-merge feature for pull requests.

Pull request auto-merge works in the opposite direction, merging the topic branch into the base branch once required status checks pass. As far as I can tell, it remains the case that there is no API for enabling auto-merge for a repository. There’s a GraphQL mutation for enabling auto-merge for a specific PR but no way to programmatically enable auto-merge at the repository level.

This has limited adoption of auto-merge in my organization. We use the Settings app to allow users to modify repository settings and might also be interesting in bulk-enabling auto-merge across all repos in our organization. Since a repository administrator needs to enable each repository via the web UI, we’ve trialed (and loved) auto-merge on a few repos but are waiting for an API (preferably PATCH /repos/{owner}/{repo}) before adopting/advertising it more broadly.

1 Like

Ahh, yes that is correct. I will see if this is being discussed. Thanks for the correction here.