Update pull_code.sh

This commit is contained in:
شركة خبير المحدودة 2025-04-06 14:20:05 +02:00 committed by GitHub
parent 6bd9e85a01
commit d619b9d00e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 1 deletions

View File

@ -15,9 +15,22 @@ PROJECT_SERVICE="$3"
STAGE="$4"
FOLDER="$5"
BRANCH="$6"
GH_TOKEN="$7"
# Stash changes before pulling
sudo -u "$PROJECT_USER" bash -c "cd '$PROJECT_PATH/$STAGE/$FOLDER' && git stash && git stash clear && git pull origin '$BRANCH'"
sudo -u "$PROJECT_USER" bash -c "
cd '$PROJECT_PATH/$STAGE/$FOLDER' && \
echo 'echo \"$GH_TOKEN\"' > ~/git-askpass.sh && \
chmod +x ~/git-askpass.sh && \
export GIT_ASKPASS=~/git-askpass.sh && \
git config --global core.askPass ~/git-askpass.sh && \
git config --global user.name 'github-actions' && \
git config --global user.email 'github-actions@github.com' && \
git stash && \
git stash clear && \
git pull origin '$BRANCH'"
if [ $? -eq 0 ]; then
echo "** [INFO] Git pull origin $BRANCH command executed successfully."
else
@ -25,6 +38,8 @@ else
exit 1
fi
sudo -u odoo bash -c "rm -f ~/git-askpass.sh"
# Restart the project service
sudo systemctl restart "$PROJECT_SERVICE"
if [ $? -eq 0 ]; then