2024-09-13 09:46:01 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# get the current branch name
|
|
|
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
|
|
|
|
# get the latest commit hashes from origin and local
|
|
|
|
git fetch origin
|
|
|
|
LOCAL=$(git rev-parse HEAD)
|
|
|
|
REMOTE=$(git rev-parse origin/$BRANCH)
|
|
|
|
|
|
|
|
# check if the local branch differs from the remote branch
|
2024-09-13 13:06:25 +02:00
|
|
|
if [ "$LOCAL" == "$REMOTE" ]; then
|
2024-09-13 09:46:01 +02:00
|
|
|
echo "pulling changes from origin"
|
|
|
|
git pull origin $BRANCH
|
|
|
|
|
|
|
|
# run the command
|
2024-09-13 13:15:06 +02:00
|
|
|
echo "Running gw-test"
|
|
|
|
shopt -s expand_aliases
|
|
|
|
source .aliases
|
|
|
|
gw-test
|
2024-09-13 09:46:01 +02:00
|
|
|
else
|
|
|
|
echo "no changes detected on the origin branch"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "waiting for 1 minute before checking again..."
|
|
|
|
sleep 60
|
|
|
|
done
|