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'
description: 'Useful to push files to another repository to be used, for example, via github pages'
inputs:
source-before-directory:
description: 'Source before directory from the origin directory'
required: false
source-directory:
description: 'Source directory from the origin directory'
required: true
@ -37,6 +40,7 @@ runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.source-before-directory }}
- ${{ inputs.source-directory }}
- ${{ inputs.destination-github-username }}
- ${{ 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
echo "[+] Action start"
SOURCE_DIRECTORY="$1"
DESTINATION_GITHUB_USERNAME="$2"
DESTINATION_REPOSITORY_NAME="$3"
USER_EMAIL="$4"
USER_NAME="$5"
DESTINATION_REPOSITORY_USERNAME="$6"
TARGET_BRANCH="$7"
COMMIT_MESSAGE="$8"
TARGET_DIRECTORY="$9"
SOURCE_BEFORE_DIRECTORY="$1"
SOURCE_DIRECTORY="$2"
DESTINATION_GITHUB_USERNAME="$3"
DESTINATION_REPOSITORY_NAME="$4"
USER_EMAIL="$5"
USER_NAME="$6"
DESTINATION_REPOSITORY_USERNAME="$7"
TARGET_BRANCH="$8"
COMMIT_MESSAGE="$9"
TARGET_DIRECTORY="$10"
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
then
@ -51,6 +52,10 @@ mkdir -p "$CLONE_DIR/$TARGET_DIRECTORY"
mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
echo "[+] Changing to $SOURCE_BEFORE_DIRECTORY"
cd $SOURCE_BEFORE_DIRECTORY
if [ ! -d "$SOURCE_DIRECTORY" ]
then
echo "ERROR: $SOURCE_DIRECTORY does not exist"