mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2025-01-10 00:59:01 -07:00
excluded directories and fixes on copy all repo
This commit is contained in:
parent
cbe757f8d8
commit
31935d560b
|
@ -54,6 +54,9 @@ 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
|
||||||
|
exclude-directories:
|
||||||
|
description: '[Optional] The directory to exclude for remove from remote repo'
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: docker
|
using: docker
|
||||||
|
@ -71,6 +74,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.exclude-directories }}'
|
||||||
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}"
|
||||||
|
EXCLUDE_DIRECTORIES="${13}"
|
||||||
|
|
||||||
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
|
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
|
||||||
then
|
then
|
||||||
|
@ -115,7 +116,7 @@ mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
|
||||||
|
|
||||||
echo "[+] List contents of $SOURCE_DIRECTORY"
|
echo "[+] List contents of $SOURCE_DIRECTORY"
|
||||||
ls "$SOURCE_DIRECTORY"
|
ls "$SOURCE_DIRECTORY"
|
||||||
|
rm -rf "$SOURCE_DIRECTORY/.git"
|
||||||
echo "[+] Checking if local $SOURCE_DIRECTORY exist"
|
echo "[+] Checking if local $SOURCE_DIRECTORY exist"
|
||||||
if [ ! -d "$SOURCE_DIRECTORY" ]
|
if [ ! -d "$SOURCE_DIRECTORY" ]
|
||||||
then
|
then
|
||||||
|
@ -136,6 +137,7 @@ cp -ra "$SOURCE_DIRECTORY"/. "$CLONE_DIR/$TARGET_DIRECTORY"
|
||||||
cd "$CLONE_DIR"
|
cd "$CLONE_DIR"
|
||||||
|
|
||||||
echo "[+] Files that will be pushed"
|
echo "[+] Files that will be pushed"
|
||||||
|
chown -R $(id -u):$(id -g) .
|
||||||
ls -la
|
ls -la
|
||||||
|
|
||||||
ORIGIN_COMMIT="https://$GITHUB_SERVER/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
|
ORIGIN_COMMIT="https://$GITHUB_SERVER/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
|
||||||
|
@ -155,7 +157,12 @@ fi
|
||||||
|
|
||||||
echo "[+] Adding git commit"
|
echo "[+] Adding git commit"
|
||||||
git add .
|
git add .
|
||||||
|
if [ -n "$EXCLUDE_DIRECTORIES" ]
|
||||||
|
then
|
||||||
|
echo "[+] Checkout excluded dirs"
|
||||||
|
git reset -- "$EXCLUDE_DIRECTORIES"
|
||||||
|
git restore "$EXCLUDE_DIRECTORIES"
|
||||||
|
fi
|
||||||
echo "[+] git status:"
|
echo "[+] git status:"
|
||||||
git status
|
git status
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user