I am rejecting a merge request if the commit message does not begin with “DTS”.
The problem is when the message is updated in the same window and the Merge button is pressed, I get a message saying “You are attempting to modify a pull request based on out-of-date information.”
Is there a way to reject a merge request without updating the object so that I am able to use the same window to update the commit message instead of reloading the page?
This is the gist of the function:
public class MergeDTSChecker implements RepositoryMergeCheck {
public RepositoryHookResult preUpdate(@Nonnull PreRepositoryHookContext context,
@Nonnull PullRequestMergeHookRequest request) {
if (! message_matcher.matches()) {
return RepositoryHookResult.rejected(summaryMsg, detailedMsg);
} else {
return RepositoryHookResult.accepted();
}
}
}
Thanks for your help.