Skip to content

Commit ab03c2e

Browse files
committed
Merge branch 'ci/fix_fetch_git_diff_on_schedules' into 'master'
ci: fix fetch git diff from pipeline schedules See merge request espressif/esp-idf!27263
2 parents 76011fc + 294222e commit ab03c2e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.gitlab/ci/common.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,14 @@ variables:
270270
git fetch origin $CI_COMMIT_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
271271
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_COMMIT_SHA)
272272
# other pipelines, like the protected branches pipelines
273-
else
273+
elif [[ "$CI_COMMIT_BEFORE_SHA" != "0000000000000000000000000000000000000000" ]]; then
274274
git fetch origin $CI_COMMIT_BEFORE_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
275275
git fetch origin $CI_COMMIT_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
276276
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA)
277+
else
278+
# pipeline source could be web, scheduler, etc.
279+
git fetch origin $CI_COMMIT_SHA --depth=2 ${GIT_FETCH_EXTRA_FLAGS}
280+
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_COMMIT_SHA~1 $CI_COMMIT_SHA)
277281
fi
278282
- *git_checkout_fetch_head
279283
- *common-before_scripts

0 commit comments

Comments
 (0)