diff --git a/README.md b/README.md index 3b05ac10..0e84063f 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,8 @@ jobs: Create a `.templatesyncignore` file. Just like writing a `.gitignore` file, follow the [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) in defining the files and folders that should be excluded from syncing with the template repository. +_Note: It is not possible to sync also the `.templatesyncignore` itself. Any changes from the template repository will be restored automatically._ + ## Debug You must create a secret named `ACTIONS_STEP_DEBUG` with the value `true` to see the debug messages set by this command in the log. For more information, see "[Enabling debug logging.][enabling-debug-logging]" diff --git a/src/sync_template.sh b/src/sync_template.sh index a0a16b3b..b750d232 100755 --- a/src/sync_template.sh +++ b/src/sync_template.sh @@ -56,6 +56,14 @@ echo "::debug::pull changes from template" git pull "${SOURCE_REPO}" --allow-unrelated-histories --squash --strategy=recursive -X theirs echo "::endgroup::" +if [ -s ${TEMPLATE_SYNC_IGNORE_FILE_NAME} ] +then + echo "::group::restore ignore file" + git reset ${TEMPLATE_SYNC_IGNORE_FILE_NAME} + git checkout -- ${TEMPLATE_SYNC_IGNORE_FILE_NAME} + echo "::endgroup::" +fi + echo "::group::persist template version" echo "write new template version file" echo "${NEW_TEMPLATE_GIT_HASH}" > ${TEMPLATE_VERSION_FILE_NAME}