Add some fixes

This commit is contained in:
Eliminater74 2021-08-29 08:24:21 -04:00
parent b4480ee4f3
commit 7a8c60c186
No known key found for this signature in database
GPG Key ID: 2DB13AFD9AF1A53C
2 changed files with 18 additions and 9 deletions

View File

@ -1,6 +1,9 @@
name: 'Push directory to another repository directory' name: 'Push directory to another repository directory'
description: 'Useful to push files to another repository to be used, for example, via github pages' description: 'Useful to push files to another repository to be used, for example, via github pages'
inputs: inputs:
source-before-directory:
description: 'Source before directory from the origin directory'
required: false
source-directory: source-directory:
description: 'Source directory from the origin directory' description: 'Source directory from the origin directory'
required: true required: true
@ -37,6 +40,7 @@ runs:
using: 'docker' using: 'docker'
image: 'Dockerfile' image: 'Dockerfile'
args: args:
- ${{ inputs.source-before-directory }}
- ${{ inputs.source-directory }} - ${{ inputs.source-directory }}
- ${{ inputs.destination-github-username }} - ${{ inputs.destination-github-username }}
- ${{ inputs.destination-repository-name }} - ${{ inputs.destination-repository-name }}

View File

@ -4,15 +4,16 @@ set -e # if a command fails it stops the execution
set -u # script fails if trying to access to an undefined variable set -u # script fails if trying to access to an undefined variable
echo "[+] Action start" echo "[+] Action start"
SOURCE_DIRECTORY="$1" SOURCE_BEFORE_DIRECTORY="$1"
DESTINATION_GITHUB_USERNAME="$2" SOURCE_DIRECTORY="$2"
DESTINATION_REPOSITORY_NAME="$3" DESTINATION_GITHUB_USERNAME="$3"
USER_EMAIL="$4" DESTINATION_REPOSITORY_NAME="$4"
USER_NAME="$5" USER_EMAIL="$5"
DESTINATION_REPOSITORY_USERNAME="$6" USER_NAME="$6"
TARGET_BRANCH="$7" DESTINATION_REPOSITORY_USERNAME="$7"
COMMIT_MESSAGE="$8" TARGET_BRANCH="$8"
TARGET_DIRECTORY="$9" COMMIT_MESSAGE="$9"
TARGET_DIRECTORY="$10"
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ] if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
then then
@ -51,6 +52,10 @@ mkdir -p "$CLONE_DIR/$TARGET_DIRECTORY"
mv "$TEMP_DIR/.git" "$CLONE_DIR/.git" mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
echo "[+] Changing to $SOURCE_BEFORE_DIRECTORY"
cd $SOURCE_BEFORE_DIRECTORY
if [ ! -d "$SOURCE_DIRECTORY" ] if [ ! -d "$SOURCE_DIRECTORY" ]
then then
echo "ERROR: $SOURCE_DIRECTORY does not exist" echo "ERROR: $SOURCE_DIRECTORY does not exist"