ci: Fix identifying commits in MR

When a MR uses a private namespace, "origin" refers to that, and its
master branch may be outdated with regard to upstream master.

We are really only interested in checking the line changes from the commits
in the MR, so figure out the correct branch point instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/647
This commit is contained in:
Florian Müllner 2019-07-25 22:26:19 +02:00
parent 17e32bf16d
commit 1b7ff76092

View File

@ -67,7 +67,10 @@ create_common() {
} }
if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
commit_range=origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME...$CI_COMMIT_SHA git fetch $CI_MERGE_REQUEST_PROJECT_URL.git $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
branch_point=$(git merge-base HEAD FETCH_HEAD)
commit_range=$branch_point...$CI_COMMIT_SHA
list_commit_range_additions $commit_range > $LINE_CHANGES list_commit_range_additions $commit_range > $LINE_CHANGES
# Don't bother with running lint when no JS changed # Don't bother with running lint when no JS changed