From 7fe1143c746067f656e03b7af1d5feedce437009 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 27 Dec 2024 15:59:59 +0100 Subject: [PATCH] check if library commit is correct Signed-off-by: tobiasKaminsky --- scripts/analysis/detectWrongSettings.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/analysis/detectWrongSettings.sh b/scripts/analysis/detectWrongSettings.sh index 486d44ccb78c..f1d1916e026c 100755 --- a/scripts/analysis/detectWrongSettings.sh +++ b/scripts/analysis/detectWrongSettings.sh @@ -6,8 +6,15 @@ snapshotCount=$(./gradlew dependencies | grep SNAPSHOT -c) betaCount=$(grep "true" app/src/main/res/values/setup.xml -c) -libraryHash=$(grep androidLibraryVersion build.gradle | cut -f2 -d'"' | grep -vi "snapshot" | grep "^[0-9a-zA-Z]\{10,40\}$" -c) +libraryHash=$(grep androidLibraryVersion build.gradle | cut -d= -f2 | tr -d \") +target=$(curl https://api.github.com/repos/nextcloud/android-library/commits/$libraryHash/pulls | jq ".[] .base.ref") +merged_at=$(curl https://api.github.com/repos/nextcloud/android-library/commits/$libraryHash/pulls | jq ".[] .merged_at") + +if [[ $target != "master" -o $merget_at == "null" ]]; then + echo "Library commit wrong!" + exit 1 +fi if [[ $snapshotCount -gt 0 ]] ; then echo "Snapshot found in dependencies" @@ -18,10 +25,5 @@ if [[ $betaCount -gt 0 ]] ; then exit 1 fi -if [[ $libraryHash -eq 0 ]] ; then - echo "Library hash is wrong!" - exit 1 -fi - exit 0