Identifying Merge Requests between jobs


Is there any existing functionality for sourcing merge requests/merge request descriptions that have occurred since the last time a particular job ran successfully? The use case here is being able to identify relevant changes to the codebase that have taken place in-between merges for a particular library or set of modules.

Example timeline:
-Job named “deploy application 1” deploys application 1
-Branch A is created from Main to work on feature for application 1
-Several commits/branches are merged to Main, applications 2 and 3 are deployed etc.
-Branch A is merged to Main
-Job named “deploy application 1” deploys application 1 again

I would like to identify the merge request descriptions that exist in-between the timeframes that “deploy application 1” ran successfully. I can currently do this with the following process:

-Get job name in currently running job
-Search successful jobs with the &scope=success filter and match for the name of the currently running job in order to extract the last successful SHA
-Get a list of SHAs between the last successful SHA and the current job commit SHA
-Iterate over the list of SHAs to extract associated MR IIDs, and filter for unique MR IIDs
-Iterate over unique list of MR IIDs and extract description

The problem with this process is it’s clunky and time consuming. The search means making paginated requests to the jobs API and using jq to filter those results for the job name. When dealing with jobs that haven’t been run for many months, you’re talking about going back hundreds of pages to find that last successful SHA. It simply doesn’t scale well. I’ve considered writing this information to an external database to query but wanted to see if anyone else had considered solutions to this? Happy to provide some code examples if it helps clarify. Thanks in advance