Skip to content

Commit

Permalink
fix(sync-template): fix issue with .templatesyncignore conflicts (#251)
Browse files Browse the repository at this point in the history
* fix(sync-template): fix issue with .templatesyncignore conflicts

* fix(sync-template): fix issue with .templatesyncignore conflicts

* docs(sync-template): update docs regarding .templatesyncignore conflicts

* fix(sync-template): fix issue with .templatesyncignore by git

* chore(sync-template): cleanup code
  • Loading branch information
msiebeneicher committed Dec 23, 2022
1 parent 4bd215e commit dd6bb2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand Down
8 changes: 8 additions & 0 deletions src/sync_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit dd6bb2c

Please sign in to comment.