mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2025-01-10 09:09:00 -07:00
add option to keep gitattributes file
This commit is contained in:
parent
07c4d7b3de
commit
3f57d6e539
|
@ -54,6 +54,12 @@ inputs:
|
||||||
[Optional] create target branch if not exist. Defaults to `false`
|
[Optional] create target branch if not exist. Defaults to `false`
|
||||||
default: false
|
default: false
|
||||||
required: 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:
|
runs:
|
||||||
using: docker
|
using: docker
|
||||||
|
@ -71,6 +77,7 @@ runs:
|
||||||
- '${{ inputs.commit-message }}'
|
- '${{ inputs.commit-message }}'
|
||||||
- '${{ inputs.target-directory }}'
|
- '${{ inputs.target-directory }}'
|
||||||
- '${{ inputs.create-target-branch-if-needed }}'
|
- '${{ inputs.create-target-branch-if-needed }}'
|
||||||
|
- '${{ inputs.keep-gitattributes }}'
|
||||||
branding:
|
branding:
|
||||||
icon: git-commit
|
icon: git-commit
|
||||||
color: green
|
color: green
|
||||||
|
|
|
@ -16,6 +16,7 @@ TARGET_BRANCH="${9}"
|
||||||
COMMIT_MESSAGE="${10}"
|
COMMIT_MESSAGE="${10}"
|
||||||
TARGET_DIRECTORY="${11}"
|
TARGET_DIRECTORY="${11}"
|
||||||
CREATE_TARGET_BRANCH_IF_NEEDED="${12}"
|
CREATE_TARGET_BRANCH_IF_NEEDED="${12}"
|
||||||
|
KEEP_GITATTRIBUTES="${13}"
|
||||||
|
|
||||||
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
|
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
|
||||||
then
|
then
|
||||||
|
@ -100,6 +101,13 @@ TEMP_DIR=$(mktemp -d)
|
||||||
# including "." and with the exception of ".git/"
|
# including "." and with the exception of ".git/"
|
||||||
mv "$CLONE_DIR/.git" "$TEMP_DIR/.git"
|
mv "$CLONE_DIR/.git" "$TEMP_DIR/.git"
|
||||||
|
|
||||||
|
# If enabled, copy .gitattributes file to keep LFS working.
|
||||||
|
if [ "$KEEP_GITATTRIBUTES" = "true" ]
|
||||||
|
then
|
||||||
|
mv "$CLONE_DIR/.gitattributes" "$TEMP_DIR/.gitattributes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# $TARGET_DIRECTORY is '' by default
|
# $TARGET_DIRECTORY is '' by default
|
||||||
ABSOLUTE_TARGET_DIRECTORY="$CLONE_DIR/$TARGET_DIRECTORY/"
|
ABSOLUTE_TARGET_DIRECTORY="$CLONE_DIR/$TARGET_DIRECTORY/"
|
||||||
|
|
||||||
|
@ -116,6 +124,11 @@ echo "[+] Listing root Location"
|
||||||
ls -al /
|
ls -al /
|
||||||
|
|
||||||
mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
|
mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
|
||||||
|
# If enabled, restore .gitattributes file to keep LFS working.
|
||||||
|
if [ "$KEEP_GITATTRIBUTES" = "true" ]
|
||||||
|
then
|
||||||
|
mv "$TEMP_DIR/.gitattributes" "$CLONE_DIR/.gitattributes"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[+] List contents of $SOURCE_DIRECTORY"
|
echo "[+] List contents of $SOURCE_DIRECTORY"
|
||||||
ls "$SOURCE_DIRECTORY"
|
ls "$SOURCE_DIRECTORY"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user