mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2025-09-03 15:35:45 -06:00
Merge 082e18d3e1eccdcdfc775eae865fbf25bb8ad950 into 7c1bd869f38327ce403753fc2a5769e26cacb5ac
This commit is contained in:
commit
75e06666f5
@ -54,6 +54,12 @@ inputs:
|
||||
[Optional] create target branch if not exist. Defaults to `false`
|
||||
default: false
|
||||
required: false
|
||||
keep-gitattributes:
|
||||
type: boolean
|
||||
description: >-
|
||||
[Optional] If true, .gitattributes will not be overwritten. Required for LFS in target repo. Defaults to `false`
|
||||
default: false
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: docker
|
||||
@ -71,6 +77,7 @@ runs:
|
||||
- '${{ inputs.commit-message }}'
|
||||
- '${{ inputs.target-directory }}'
|
||||
- '${{ inputs.create-target-branch-if-needed }}'
|
||||
- '${{ inputs.keep-gitattributes }}'
|
||||
branding:
|
||||
icon: git-commit
|
||||
color: green
|
||||
|
@ -16,6 +16,10 @@ TARGET_BRANCH="${9}"
|
||||
COMMIT_MESSAGE="${10}"
|
||||
TARGET_DIRECTORY="${11}"
|
||||
CREATE_TARGET_BRANCH_IF_NEEDED="${12}"
|
||||
KEEP_GITATTRIBUTES="${13}"
|
||||
|
||||
## Temp fix for git-lfs issue 5749
|
||||
export GIT_CLONE_PROTECTION_ACTIVE=false
|
||||
|
||||
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
|
||||
then
|
||||
@ -99,6 +103,8 @@ TEMP_DIR=$(mktemp -d)
|
||||
# but not anymore. Otherwise we had to remove the files from "$CLONE_DIR",
|
||||
# including "." and with the exception of ".git/"
|
||||
mv "$CLONE_DIR/.git" "$TEMP_DIR/.git"
|
||||
mv "$CLONE_DIR/.gitattributes" "$TEMP_DIR/.gitattributes"
|
||||
|
||||
|
||||
# $TARGET_DIRECTORY is '' by default
|
||||
ABSOLUTE_TARGET_DIRECTORY="$CLONE_DIR/$TARGET_DIRECTORY/"
|
||||
@ -116,6 +122,12 @@ echo "[+] Listing root Location"
|
||||
ls -al /
|
||||
|
||||
mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
|
||||
# If enabled, restore .gitattributes file to keep LFS working.
|
||||
if [ "$KEEP_GITATTRIBUTES" = "true" ]
|
||||
then
|
||||
echo "[+] Restoring .gitattributes file"
|
||||
mv "$TEMP_DIR/.gitattributes" "$CLONE_DIR/.gitattributes"
|
||||
fi
|
||||
|
||||
echo "[+] List contents of $SOURCE_DIRECTORY"
|
||||
ls "$SOURCE_DIRECTORY"
|
||||
|
Loading…
x
Reference in New Issue
Block a user