Java与GitLab OpenAPI交互
通过Gitlab Open api代码来操作代码的合并及关闭,项目的模板生成........https://docs.gitlab.com/13.12/ee/api/merge_requests.html#create-mr
·
通过Gitlab Open api代码来操作代码的合并及关闭,项目的模板生成........
方式一:
使用java-gitlab-api(推荐)
接口文档Java Gitlab API Documentation
<dependency>
<groupId>org.gitlab</groupId>
<artifactId>java-gitlab-api</artifactId>
<version>4.1.1</version>
</dependency>
方式二:
gitlab4j-api
文档地址https://github.com/gitlab4j/gitlab4j-api#tagsapi
<dependency>
<groupId>org.gitlab4j</groupId>
<artifactId>gitlab4j-api</artifactId>
<version>4.15.7</version>
</dependency>
编写调用局部代码:
@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()), "分支合并申请,分支没有变化!");...
引申
更多推荐
已为社区贡献1条内容
所有评论(0)