My project's code is on Github, and the CI/CD pipelines are defined in Azure DevOps. The idea is that when a new PR happens, it triggers the CI pipeline in Azure.
I've automated the creations of pipelines, using the Azure RestAPI, for that we are using: /_apis/pipelines version 7.1. I did it using this reference.
When registering it automatically through the API, the PRs are not triggering the CI pipeline; after some investigation, I found out that the trigger for PRs is, by default, disabled. As can be seen in the picture below.
Do you know any way to modify it via API, either by default enabling it or changing it after it's created?

You can
Override the YAML the PR triggerandEnable pull request validationof a GitHub repo with this API.Per the request body of above request, you may first get the latest pipeline definition revision from the response of the following API first.
We can then copy the response as the body of the
Definition-Update-APIrequest and simply update thetriggerSsection. Here is a sample json contents of the modifiedtriggersection for your reference. In the second object for"triggerType": "pullRequest", I removed"settingsSourceType": 2,and updated"branchFilters": ["+refs/heads/main"].