diff --git a/action.yml b/action.yml index 83fe5ca..2a0309d 100644 --- a/action.yml +++ b/action.yml @@ -26,6 +26,9 @@ inputs: destination_ssh_private_key: description: SSH key used to authenticate with destination ssh url provided (optional if public or https url with authentication) required: false + update_head: + description: Update HEAD reference + required: false runs: using: 'docker' image: 'Dockerfile' @@ -33,6 +36,7 @@ runs: SSH_PRIVATE_KEY: ${{ inputs.ssh_private_key }} SOURCE_SSH_PRIVATE_KEY: ${{ inputs.source_ssh_private_key }} DESTINATION_SSH_PRIVATE_KEY: ${{ inputs.destination_ssh_private_key }} + UPDATE_HEAD: ${{ inputs.update_head }} args: - ${{ inputs.source_repo }} - ${{ inputs.source_branch }} diff --git a/git-sync.sh b/git-sync.sh index 05a0e0a..08ca320 100755 --- a/git-sync.sh +++ b/git-sync.sh @@ -38,7 +38,11 @@ fi git remote add destination "$DESTINATION_REPO" # Pull all branches references down locally so subsequent commands can see them -git fetch source '+refs/heads/*:refs/heads/*' --update-head-ok +if [[ -n "$UPDATE_HEAD" && "$UPDATE_HEAD" = true ]]; then + git fetch source '+refs/heads/*:refs/heads/*' --update-head-ok +else + git fetch source '+refs/heads/*:refs/heads/*' +fi # Print out all branches git --no-pager branch -a -vv