Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to update head #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ 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'
env:
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 }}
Expand Down
6 changes: 5 additions & 1 deletion git-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down