This commit is contained in:
TheiLLeniumStudios
2023-02-06 12:00:28 +00:00
parent 492fddef88
commit c2d3b2542c
+7 -4
View File
@@ -1,6 +1,6 @@
#!/bin/sh -l #!/bin/sh -l
beginswith() { case $2 in "$1"*) true;; *) false;; esac; } beginswith() { case $2 in "$1"*) true ;; *) false ;; esac }
exists_in_array() { exists_in_array() {
local element="$1" local element="$1"
@@ -36,12 +36,12 @@ git config --global --add safe.directory /github/workspace
if [ ${GITHUB_BASE_REF} ]; then if [ ${GITHUB_BASE_REF} ]; then
# Pull Request # Pull Request
git fetch origin ${GITHUB_BASE_REF} --depth=1 git fetch origin ${GITHUB_BASE_REF} --depth=1
export DIFF=$( git diff --name-only origin/${GITHUB_BASE_REF} ${GITHUB_SHA} ) export DIFF=$(git diff --name-only origin/${GITHUB_BASE_REF} ${GITHUB_SHA})
echo "Diff between origin/${GITHUB_BASE_REF} and ${GITHUB_SHA}" echo "Diff between origin/${GITHUB_BASE_REF} and ${GITHUB_SHA}"
else else
# Push # Push
git fetch origin ${GITHUB_EVENT_BEFORE} --depth=1 git fetch origin ${GITHUB_EVENT_BEFORE} --depth=1
export DIFF=$( git diff --name-status ${GITHUB_EVENT_BEFORE} ${GITHUB_SHA} ) export DIFF=$(git diff --name-status ${GITHUB_EVENT_BEFORE} ${GITHUB_SHA})
echo "Diff between ${GITHUB_EVENT_BEFORE} and ${GITHUB_SHA}" echo "Diff between ${GITHUB_EVENT_BEFORE} and ${GITHUB_SHA}"
fi fi
@@ -61,7 +61,8 @@ echo "${DIFF}" | while read -r changed; do
done done
if ! is_array_empty "$resources_to_restart"; then if ! is_array_empty "$resources_to_restart"; then
if [ "$RESTART_INDIVIDUAL_RESOURCES" = true ] ; then echo "Array is not empty."
if [ "$RESTART_INDIVIDUAL_RESOURCES" = true ]; then
echo "Will restart individual resources" echo "Will restart individual resources"
for resource in $resources_to_restart; do for resource in $resources_to_restart; do
echo "Restarting ${resource}" echo "Restarting ${resource}"
@@ -71,4 +72,6 @@ if ! is_array_empty "$resources_to_restart"; then
echo "Will restart the whole server" echo "Will restart the whole server"
#rcon -a ${SERVER_IP}:${SERVER_PORT} -p ${RCON_PASSWORD} command 'quit "Restarting server"' #rcon -a ${SERVER_IP}:${SERVER_PORT} -p ${RCON_PASSWORD} command 'quit "Restarting server"'
fi fi
else
echo "Array is empty."
fi fi