From 00e2f35f579355b6a06d6cc6f2778da5c9a1673e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Henrique=20A=2E=20Sch=C3=BCnemann?= <44511825+LuisHenri@users.noreply.github.com> Date: Sat, 31 Dec 2022 06:02:19 -0300 Subject: [PATCH] fix(sync-template): IF order (#269) --- src/sync_template.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/sync_template.sh b/src/sync_template.sh index 812fb48..8f4aec3 100755 --- a/src/sync_template.sh +++ b/src/sync_template.sh @@ -56,6 +56,12 @@ debug "pull changes from template" git pull "${SOURCE_REPO}" --allow-unrelated-histories --squash --strategy=recursive -X theirs echo "::endgroup::" +# Check if the Ignore File exists inside .github folder or if it doesn't exist at all +if [[ -f ".github/${TEMPLATE_SYNC_IGNORE_FILE_PATH}" || ! -f "${TEMPLATE_SYNC_IGNORE_FILE_PATH}" ]]; then + debug "using ignore file as in .github folder" + TEMPLATE_SYNC_IGNORE_FILE_PATH=".github/${TEMPLATE_SYNC_IGNORE_FILE_PATH}" +fi + if [ -s "${TEMPLATE_SYNC_IGNORE_FILE_PATH}" ]; then echo "::group::restore ignore file" info "restore the ignore file" @@ -67,14 +73,9 @@ fi echo "::group::commit changes" git add . -# Check if the Ignore File exists inside .github folder or if it doesn't exist at all -if [[ -f ".github/${TEMPLATE_SYNC_IGNORE_FILE_PATH}" || ! -f "${TEMPLATE_SYNC_IGNORE_FILE_PATH}" ]]; then - debug "using ignore file as in .github folder" - TEMPLATE_SYNC_IGNORE_FILE_PATH=".github/${TEMPLATE_SYNC_IGNORE_FILE_PATH}" -fi # we are checking the ignore file if it exists or is empty # -s is true if the file contains whitespaces -if [ -s ${TEMPLATE_SYNC_IGNORE_FILE_PATH} ]; then +if [ -s "${TEMPLATE_SYNC_IGNORE_FILE_PATH}" ]; then debug "unstage files from template sync ignore" git reset --pathspec-from-file="${TEMPLATE_SYNC_IGNORE_FILE_PATH}"