You can subscribe to code push events using ADO public API: Subscription create API
You want your request to look like this:
curl -H "Content-Type: application/json;api-version=4.0" \
-H "Authorization: Basic $(B64_TOKEN)"
--request POST \
--data {
"publisherId": "tfs",
"eventType": "git.push",
"resourceVersion": "1.0",
"consumerId": "webHooks",
"consumerActionId": "httpRequest",
"consumerInputs": {"url": $(WEBHOOK_URL)}
}
https://dev.azure.com/$(ORGANIZATION)/_apis/hooks/subscriptions
This will subscribe you to all code push on all your repositories of all your projects of your organization.
When you receive a code push notification (see documentation), you can extract the commit ids from the resource
object (you might need to fetch the Push object using the API).
Then you can inspect which file are impacted with the Commit API.
If you want to see the file diff, there is also an undocumented API.