Исправление бага с анализом старых MR
Из-за неправильного формаирования ссылки для выгрузки данных об МР, мр считался удаленным
This commit is contained in:
parent
f5b30b11fa
commit
4482f7750a
@ -12,7 +12,6 @@ import dev.struchkov.bot.gitlab.core.utils.StringUtils;
|
||||
import dev.struchkov.bot.gitlab.sdk.domain.CommitJson;
|
||||
import dev.struchkov.bot.gitlab.sdk.domain.MergeRequestJson;
|
||||
import dev.struchkov.haiti.context.domain.ExistsContainer;
|
||||
import dev.struchkov.haiti.context.exception.NotFoundException;
|
||||
import dev.struchkov.haiti.context.page.Sheet;
|
||||
import dev.struchkov.haiti.context.page.impl.PaginationImpl;
|
||||
import dev.struchkov.haiti.utils.network.HttpParse;
|
||||
@ -23,6 +22,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -48,17 +48,18 @@ public class MergeRequestParser {
|
||||
final Set<IdAndStatusPr> existIds = mergeRequestsService.getAllId(OLD_STATUSES);
|
||||
|
||||
for (IdAndStatusPr existId : existIds) {
|
||||
final MergeRequest mergeRequest = HttpParse.request(MessageFormat.format(gitlabProperty.getUrlPullRequest(), existId.getProjectId(), existId.getTwoId()))
|
||||
final String mrUrl = MessageFormat.format(gitlabProperty.getUrlPullRequest(), existId.getProjectId(), existId.getTwoId());
|
||||
final Optional<MergeRequestJson> json = HttpParse.request(mrUrl)
|
||||
.header(ACCEPT)
|
||||
.header(StringUtils.H_PRIVATE_TOKEN, personProperty.getToken())
|
||||
.execute(MergeRequestJson.class)
|
||||
.map(json -> {
|
||||
final MergeRequest newMergeRequest = conversionService.convert(json, MergeRequest.class);
|
||||
.execute(MergeRequestJson.class);
|
||||
final Optional<MergeRequest> mergeRequest = json
|
||||
.map(mergeRequestJson -> {
|
||||
final MergeRequest newMergeRequest = conversionService.convert(mergeRequestJson, MergeRequest.class);
|
||||
parsingCommits(newMergeRequest);
|
||||
return newMergeRequest;
|
||||
})
|
||||
.orElseThrow(NotFoundException.supplier("МержРеквест не найден, возможно удален"));
|
||||
mergeRequestsService.update(mergeRequest);
|
||||
});
|
||||
mergeRequest.ifPresent(mergeRequestsService::update);
|
||||
}
|
||||
|
||||
}
|
||||
@ -98,7 +99,6 @@ public class MergeRequestParser {
|
||||
return mergeRequest;
|
||||
})
|
||||
.toList();
|
||||
|
||||
mergeRequestsService.createAll(newMergeRequests);
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ gitlab-bot:
|
||||
url-project: ${GITLAB_URL}/api/v4/projects?page={0, number, integer}&per_page=100
|
||||
url-pull-request-open: ${GITLAB_URL}/api/v4/projects/{0, number, integer}/merge_requests?state=opened&page={1, number, integer}&per_page=100
|
||||
url-pull-request-close: ${GITLAB_URL}
|
||||
url-pull-request-comment: "${GITLAB_URL}/api/v4/projects/{0,number,integer}/merge_requests/{1,number,integer}/notes?&page={2,number,integer}&per_page=100"
|
||||
url-pull-request: ${GITLAB_URL}/api/v4/projects/{0, number, integer}/merge_requests/{1, number, integer}?page={2, number, integer}&per_page=100
|
||||
url-pull-request-comment: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/notes?&page={2,number,#}&per_page=100"
|
||||
url-pull-request: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}"
|
||||
url-merge-request-add: ${GITLAB_URL}/api/v4/projects/{0}%2F{1}
|
||||
user-url: ${GITLAB_URL}/api/v4/user
|
||||
users-url: ${GITLAB_URL}/api/v4/users
|
||||
@ -43,5 +43,5 @@ gitlab-bot:
|
||||
url-pipeline: "${GITLAB_URL}/api/v4/projects/{0,number,#}/pipelines/{1,number,#}"
|
||||
url-commit: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/commits?&page=1&per_page=1"
|
||||
url-new-note: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}/notes?body={3}"
|
||||
url-discussion: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions?&page={2,number,integer}&per_page=100"
|
||||
url-discussion: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions?&page={2,number,#}&per_page=100"
|
||||
url-one-discussion: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}"
|
2
pom.xml
2
pom.xml
@ -52,7 +52,7 @@
|
||||
<gitlab.telegram.version>3.1.0</gitlab.telegram.version>
|
||||
<gitlab.core.version>3.1.0</gitlab.core.version>
|
||||
|
||||
<haiti.ver>0.0.5</haiti.ver>
|
||||
<haiti.ver>1.0.0</haiti.ver>
|
||||
<godfather.telegram.core.version>0.0.2</godfather.telegram.core.version>
|
||||
|
||||
<javax.persistance.version>2.2</javax.persistance.version>
|
||||
|
Loading…
Reference in New Issue
Block a user