From 030561cc35f4bb1ffc15f64c87326c213cbb7218 Mon Sep 17 00:00:00 2001 From: "aleksandr.masliaev" Date: Thu, 12 Dec 2024 20:34:38 +0800 Subject: [PATCH] check actual pipeline --- src/main/kotlin/marge_kot/helpers/PipelineWaiter.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/marge_kot/helpers/PipelineWaiter.kt b/src/main/kotlin/marge_kot/helpers/PipelineWaiter.kt index 6c7edba..f124c01 100644 --- a/src/main/kotlin/marge_kot/helpers/PipelineWaiter.kt +++ b/src/main/kotlin/marge_kot/helpers/PipelineWaiter.kt @@ -23,9 +23,15 @@ class PipelineWaiter( onOutdated = { throw NeedRebaseException() } ) Napier.v("Get pipeline for current merge request") - val pipeline = mergeRequest.pipeline?.id?.let { - repository.getPipeline(mergeRequest.pipeline.id) + val mergeRequestPipeline = mergeRequest.pipeline + val pipeline = mergeRequestPipeline?.id?.let { + repository.getPipeline(mergeRequestPipeline.id) } ?: throw NeedRebaseException() + Napier.v("Check if pipeline is actual") + if (mergeRequest.diffRefs?.headSha != pipeline.sha) { + Napier.v("Need to wait for a fresh pipeline") + continue + } Napier.v("Pipeline status is ${pipeline.status}") when (pipeline.status) { Pipeline.Status.SUCCESS -> return