INFRA-3209 | Dhruv | update check failure condition

This commit is contained in:
dhruvjoshi
2024-05-02 12:14:49 +05:30
parent be69740cbc
commit 6db48280fd

View File

@@ -30,12 +30,8 @@ jobs:
git fetch origin main
BEHIND=$(git rev-list origin/main ^HEAD --count)
AHEAD=$(git rev-list HEAD ^origin/main --count)
if [ $AHEAD -gt 2 ]; then
echo "Submodule is more than 2 commits ahead of main branch."
if [ $AHEAD -ne 0] || [$BEHIND -ne 0 ]; then
echo "Submodule is not up to date with main branch."
exit 1
elif [ $BEHIND -gt 2 ]; then
echo "Submodule is more than 2 commits behind main branch."
exit 1
else
echo "Submodule is within 2 commits of main branch."
fi
echo "Submodule is up to date with main branch."