We have a typical workflow where development is done on Git feature branches. Changes on master are pulled into the feature branch and when finished, the feature branch is merged into master (which mostly works without conflicts).
The feature branches are built continuously on Jenkins (one project per branch), especially in order to run tests that are difficult to do on development machines. A notification of the outcome of those builds (failure or success) must be sent to the involved developers. From a practical point of view the involved developers are those working on the feature branch. It is not necessary that all of those developers get a notification, it would be sufficient to send it to that person that did the last change on the branch (meaning: changing the value of the branches HEAD).
The question is: How to determine those developers programatically? I am aware of the fact that this might not be possible to 100%, the goal is to find a feasible but not perfect solution.
Something that must not happen is that commit authors that never worked on the branch get notifications. When master is merged into the branch and after the initial branch creation there are (a lot of) commit authors not related to the branch.
I will put the approach I have in mind as answer, but I am interested if there are better solutions.