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-banned-apis.sh b/script/static-checks/static-checks-banned-apis.sh
index 0e55a23..4bab6a7 100755
--- a/script/static-checks/static-checks-banned-apis.sh
+++ b/script/static-checks/static-checks-banned-apis.sh
@@ -7,13 +7,17 @@
 
 # static-checks-banned-apis.sh <path-to-root-folder> [patch]
 
+this_dir="$(readlink -f "$(dirname "$0")")"
+. $this_dir/common.sh
+
+
 LOG_FILE=$(mktemp -t banned-api-check.XXXX)
 
 if [[ "$2" == "patch" ]]; then
   echo "# Check for banned APIs in the patch"
   TEST_CASE="Banned API check on patch(es)"
   "$CI_ROOT/script/static-checks/check-banned-api.py" --tree "$1" \
-      --patch --from-ref origin/master \
+      --patch --from-ref $(get_merge_base) \
       &> "$LOG_FILE"
 else
   echo "# Check for banned APIs in entire source tree"