From 1b7ff760924d9a8544f32da937e89d0e23de68b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 25 Jul 2019 22:26:19 +0200 Subject: [PATCH] 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 --- .gitlab-ci/run-eslint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci/run-eslint.sh b/.gitlab-ci/run-eslint.sh index 4732f986f..0f745a58d 100755 --- a/.gitlab-ci/run-eslint.sh +++ b/.gitlab-ci/run-eslint.sh @@ -67,7 +67,10 @@ create_common() { } 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 # Don't bother with running lint when no JS changed