Hi,
I am trying to write a merge hook plugin that will allow me to get a handle to all files in a pull request before being merged. I need to run additional integrity checks on the files in pull request. Any tips or pointers would be appreciated.
Hi,
I am trying to write a merge hook plugin that will allow me to get a handle to all files in a pull request before being merged. I need to run additional integrity checks on the files in pull request. Any tips or pointers would be appreciated.
For anyone else who is looking for this.
public class MyPostRepoHook implements PostRepositoryHook<RepositoryHookRequest> {
private ScmService scmService;
public MyPostRepoHook( @ComponentImport final ScmService scmService ) {
this.scmService = scmService;
}
@Override
public void postUpdate( PostRepositoryHookContext context, RepositoryHookRequest request ) {
request.getRefChanges().stream()
.forEach( refChange -> scmService.getBulkContentCommandFactory( request.getRepository() )
.contents( new BulkContentCommandParameters.Builder( refChange.getToHash() )
.sinceCommitId( refChange.getFromHash() )
.build(), new BulkContentCallback() {
@Override
public void onFile( @Nonnull BulkFile file, @Nonnull InputStream content ) {
//Implement here
}
} ).call() );
}
}