From 5f62667aba7a2354998f7f7283e551a53b507a6e Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Thu, 31 Oct 2024 11:30:50 +0100 Subject: [PATCH] ci: use different base commit for merge result pipelines --- .gitlab/ci/pre_check.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitlab/ci/pre_check.yml b/.gitlab/ci/pre_check.yml index 2acc5ef0bf..5b1adf2429 100644 --- a/.gitlab/ci/pre_check.yml +++ b/.gitlab/ci/pre_check.yml @@ -183,12 +183,24 @@ baseline_manifest_sha: tags: [fast_run, shiny] script: - | - if [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then + # merged results pipelines, by default + # diff between target-branch-head and merged-result-head + if [ -n "$CI_MERGE_REQUEST_TARGET_BRANCH_SHA" ]; then + git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_SHA --depth=1 + git checkout FETCH_HEAD + idf-build-apps dump-manifest-sha \ + --manifest-files $(find . -name ".build-test-rules.yml" | xargs) \ + --output .manifest_sha + # merge request pipelines, when the mr got conflicts + # diff between diff-base-sha and merge-request-head + elif [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then git fetch origin $CI_MERGE_REQUEST_DIFF_BASE_SHA --depth=1 git checkout FETCH_HEAD idf-build-apps dump-manifest-sha \ --manifest-files $(find . -name ".build-test-rules.yml" | xargs) \ --output .manifest_sha + # other pipelines, like the protected branches pipelines + # not triggered in this job fi artifacts: paths: