Skip to content

Commit

Permalink
fix: 🐛 (#401) fix some small issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasAugustin committed Jan 18, 2024
1 parent 751807c commit c82afad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ jobs:
| is_force_deletion | `[optional]` set to `true` if you want to force delete files which are deleted within the source repository even if they contain changes" | `false` | `false` |
| git_user_name | `[optional]` set the committer git user.name | `false` | `${GITHUB_ACTOR}` |
| git_user_email | `[optional]` set the committer git user.email | `false` | `github-action@actions-template-sync.noreply.${SOURCE_REPO_HOSTNAME}` |
| git_remote_pull_params |`[optional]` set remote pull parameters | `false` | `--allow-unrelated-histories --strategy=recursive -X theirs` |
| git_remote_pull_params |`[optional]` set remote pull parameters | `false` | `--allow-unrelated-histories --squash --strategy=recursive -X theirs` |

### Docker

Expand Down
8 changes: 6 additions & 2 deletions src/sync_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ if [[ -n "${SRC_SSH_PRIVATEKEY_ABS_PATH}" ]]; then
export GIT_SSH_COMMAND="ssh -i ${SRC_SSH_PRIVATEKEY_ABS_PATH}"
fi

GIT_REMOTE_PULL_PARAMS="${GIT_REMOTE_PULL_PARAMS:---allow-unrelated-histories --strategy=recursive -X theirs}"
GIT_REMOTE_PULL_PARAMS="${GIT_REMOTE_PULL_PARAMS:---allow-unrelated-histories --squash --strategy=recursive -X theirs}"

cmd_from_yml_file "install"

LOCAL_CURRENT_GIT_HASH=$(git rev-parse HEAD)

info "current git hash: ${LOCAL_CURRENT_GIT_HASH}"

TEMPLATE_SYNC_IGNORE_FILE_PATH=".templatesyncignore"
TEMPLATE_REMOTE_GIT_HASH=$(git ls-remote "${SOURCE_REPO}" HEAD | awk '{print $1}')
NEW_TEMPLATE_GIT_HASH=$(git rev-parse --short "${TEMPLATE_REMOTE_GIT_HASH}")
Expand Down Expand Up @@ -97,7 +101,7 @@ fi
function force_delete_files() {
echo "::group::force file deletion"
warn "force file deletion is enabled. Deleting files which are deleted within the target repository"
FILES_TO_DELETE=$(git log --diff-filter D --pretty="format:" --name-only "${TEMPLATE_REMOTE_GIT_HASH}"..HEAD | sed '/^$/d')
FILES_TO_DELETE=$(git log --diff-filter D --pretty="format:" --name-only "${LOCAL_CURRENT_GIT_HASH}"..HEAD | sed '/^$/d')
warn "files to delete: ${FILES_TO_DELETE}"
if [[ -n "${FILES_TO_DELETE}" ]]; then
echo "${FILES_TO_DELETE}" | xargs rm
Expand Down

0 comments on commit c82afad

Please sign in to comment.