通过Gitlab Open api代码来操作代码的合并及关闭,项目的模板生成........
方式一:
使用java-gitlab-api(推荐)
接口文档Java Gitlab API Documentation
org.gitlab
java-gitlab-api
4.1.1
方式二:
gitlab4j-api
文档地址https://github.com/gitlab4j/gitlab4j-api#tagsapi
org.gitlab4j
gitlab4j-api
4.15.7
编写调用局部代码:
@PostConstruct public void init(){ gitlabAPI = GitlabAPI.connect(gitLabConfigProperties.getHostUrl(),gitLabConfigProperties.getAdminAccessToken()); }
【例】分支比较,传递时需要对调分支
....
GitlabCommitComparison compare = gitlabAPI.compareCommits(mergeApplyDTO.getGitlabProjectId(),mergeApplyDTO.getTargetBranch(),mergeApplyDTO.getSourceBranch()); Assert.isTrue(!CollectionUtils.isEmpty(compare.getDiffs()), "分支合并申请,分支没有变化!");...
引申