Implement Github Auto merge via API - github

As per https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request , auto-merge option is available in GitHub . But, it is a manual process. Is there any way to automate it via API ? Please share APIs that can be used to implement auto-merge feature in GitHub .
Thanks,

Related

Deploy changes from GitHub to Salesforce

How can I add a custom button on GitHub.com which I could click on in order to deploy changes from the Master branch to a related Salesforce.com DEV Org?
What have you tried? Have you seen https://developer.salesforce.com/blogs/2020/01/using-salesforce-dx-with-github-actions ?
You can steal sample actions from SF official repo at https://github.com/trailheadapps/lwc-recipes.
You'll need to provide the secret login URL to your target org, there are blog posts how to generate it and store in GitHub variable, for example https://tigerfacesystems.com/blog/sfdx-continuous-integration/ or https://github.com/sfdx-actions/setup-sfdx
Last but not least - to have action available for manual run (not just automated) read up about "workflow_dispatch"

Require deployments to succeed before merging API REST

I'm working on a GitHub Entreprise Project and in my approach of automating some branches policy configuration, I wanted to use GitHub REST API to automatically :
Require a pull request before merging
Allow specified actors to bypass required pull requests
Require status checks to pass before merging
Restrict who can push to matching branches
Require deployments to succeed before merging
All of these point succedded using the Update branch protection API REST but the last point.
It seems that the REST API doesn't make it possible to check this point.
Does anyone know if there is a hidden way to do that with API REST or GitHub CLI integrated to GitHub Action ?
Thanking you for any help :)

Programmatically enable GitHub Discussions for a repository

Is there a way to enable GitHub Discussions for a repository using the GitHub API? The only way to enable discussions that I could find is manually through the Settings page.
GitHub recently released the Discussions GraphQL API. The documentation for the API is available here.
With the GitHub CLI gh v2.22.0 (Jan. 2023), you can do so using gh repo edit --enable-discussions[=false]:
It enables/disables the discussion on your remote GitHub repository right from command-line.
That way, you don't have to directly manipulate the GH API: the API call is done for you through the API.

Github custom pull request template

Currently, Github supports a pull request template present in the default branch(Link). In our team, we want to configure pull request template based on the folder or file modified.
Example configuration we want to support:
documentation/ : DOCUMENTATION_TEMPLATE.md
src/**/*.h : INTERFACE_TEMPLATE.md
src/**/*.cpp : IMPLEMENTATION_TEMPLATE.md
.config/ : CONFIGURATION_TEMPLATE.md
From the Github documentation for Pull requests templates, this seems to be not possible. Can this be achieved either by using Github Webhooks or Github apps?
I have contacted Github and they informed that currently this is not possible. So we ended building a Github App

API for releasing actions to Github Marketplace

Is there an API or a programmatic way to release an action to Github Marketplace? Most actions/APIs are for creating a release in the Repo itself but releasing to marketplace seems like a UI only feature. Does anyone if there's an API or cli method for doing so?
It is true, as mentioned in GitHub Marketplace, that:
Anyone can publish an action in GitHub Marketplace as long as they meet the terms of service. Unlike apps, GitHub Actions listed in GitHub Marketplace are not verified by GitHub.
In that regard, the process could benefit from an API.
But while there is a GitHub Marketplace API, it does not include the publication process itself, which remains a manual process for now.