Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit 8240936

Browse files
authored
[AAE-9334] Improve update project script (#1395)
1 parent a7fc2e9 commit 8240936

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

scripts/update-project.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ cd $TEMP_GENERATOR_DIR
5858
git fetch
5959

6060
# Checkout branch if exist, otherwise create it
61-
git checkout $BRANCH_TO_CREATE 2>/dev/null || git checkout -b $BRANCH_TO_CREATE origin/develop
61+
BRANCH_CREATED=false
62+
if git checkout $BRANCH_TO_CREATE 2>/dev/null ; then
63+
git reset --hard origin/develop
64+
else
65+
BRANCH_CREATED=true
66+
git checkout -b $BRANCH_TO_CREATE origin/develop
67+
fi
6268

6369
JS_VERSION=$(npm view @alfresco/js-api@$VERSION version)
6470

@@ -79,7 +85,11 @@ done
7985

8086
git add .
8187
git commit -n -m "[ci:force][auto-commit] Update JS-API to $JS_VERSION for branch: $BRANCH_TO_CREATE originated from JS-API PR: $JSAPI_PR_NUMBER"
82-
git push origin $BRANCH_TO_CREATE
88+
if [ "$BRANCH_CREATED" = true ]; then
89+
git push origin $BRANCH_TO_CREATE
90+
else
91+
git push --force origin $BRANCH_TO_CREATE
92+
fi
8393

8494
node $BUILD_PIPELINE_DIR/pr-creator.js --token=$TOKEN --title="Update branch for JS-API PR#$JSAPI_PR_NUMBER" --head=$BRANCH_TO_CREATE --repo=alfresco-ng2-components
8595

0 commit comments

Comments
 (0)