Skip to content

Commit

Permalink
fix(sync-template): IF order (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisHenri authored Dec 31, 2022
1 parent 67b630b commit 00e2f35
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/sync_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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}"

Expand Down

0 comments on commit 00e2f35

Please sign in to comment.