static-checks: Use proper ref branch when collecting commits to test

Use the actual branch specified in the CI run, instead of hardcoded
master/integration.

Addresses https://linaro.atlassian.net/browse/TFC-636

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: Ic0fd0677978f226626d567108f17ccb864aa8095
diff --git a/script/static-checks/static-checks-check-copyright.sh b/script/static-checks/static-checks-check-copyright.sh
index ee92c92..9759b5f 100755
--- a/script/static-checks/static-checks-check-copyright.sh
+++ b/script/static-checks/static-checks-check-copyright.sh
@@ -6,6 +6,11 @@
 #
 
 # test-package-check-copyright.sh DIRECTORY
+
+this_dir="$(readlink -f "$(dirname "$0")")"
+. $this_dir/common.sh
+
+
 DIRECTORY="$1"
 
 TEST_CASE="Copyright headers of files modified by this patch"
@@ -14,7 +19,7 @@
 
 LOG_FILE=`mktemp -t common.XXXX`
 
-"$CI_ROOT"/script/static-checks/check-copyright.py --tree "$DIRECTORY" --patch &> "$LOG_FILE"
+"$CI_ROOT"/script/static-checks/check-copyright.py --tree "$DIRECTORY" --patch --from-ref $(get_merge_base) &> "$LOG_FILE"
 RES=$?
 
 if [ -s "$LOG_FILE" ]; then