Skip to content

Commit

Permalink
ci: fix fetch git diff from pipeline schedules
Browse files Browse the repository at this point in the history
  • Loading branch information
ydesp committed Nov 20, 2023
1 parent f2a0beb commit 294222e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .gitlab/ci/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,14 @@ variables:
git fetch origin $CI_COMMIT_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_COMMIT_SHA)
# other pipelines, like the protected branches pipelines
else
elif [[ "$CI_COMMIT_BEFORE_SHA" != "0000000000000000000000000000000000000000" ]]; then
git fetch origin $CI_COMMIT_BEFORE_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
git fetch origin $CI_COMMIT_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA)
else
# pipeline source could be web, scheduler, etc.
git fetch origin $CI_COMMIT_SHA --depth=2 ${GIT_FETCH_EXTRA_FLAGS}
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_COMMIT_SHA~1 $CI_COMMIT_SHA)
fi
- *git_checkout_fetch_head
- *common-before_scripts
Expand Down

0 comments on commit 294222e

Please sign in to comment.