Hello,
We have an idea of creating a pre-receive hook handler using ScritpRunner, which would only allow a push (containing some specific entries in any commit), if there is a special entry in one of the commit messages within this push request.
With PreRepositoryHookCommitCallback I can read the changes content and a commit message, but only from within the current commit. Is there a way to access other commits from a specific push?
Here is a pseudocode of what we try to accomplish:
commitCallback =
new PreRepositoryHookCommitCallback() {
@Override
boolean onCommitAdded(@Nonnull CommitAddedDetails commitDetails) {
if (commit.refChanges.any( contains a string matching a pattern) && !allPushCommits.any( has a message containing a special entry) ){
resultBuilder.veto("not allowed")
return false
}
}