See if a repository at a specific commit "contains" another commit (similar to is-ancestor)

Hi,

Is it possible via GraphQL (or Rest API for that matter) to detect whether a repository at a specific commit contains another commit? I’m trying to programmatically detect whether an artifact is safe to deploy (i.e whether the code running on the current customer has been merged into the new code you are trying to deploy).

So I might have a customer running branch X (commit Y), and then I want to release master (commit Z) and now I need to see: Does Z include the data from branch X (does it include commit Y)

This is going to be done programmatically over a number of repositories in semi-real time in an API so I would strongly prefer using Github API over creating a docker container, checking out all of the source code, running git commands etc.

So far I’ve searched and found Please expose "git merge-base --is-ancestor" as an API but no other status

Regards,
Niklas