set options to make it easier to debug if a command fails

Make use of optional arguments on action.yml in order to avoid testing
against an undefined variable
This commit is contained in:
Carles Pina i Estany 2020-11-04 15:02:44 +00:00
parent 884b652fa7
commit da21c6b08d
2 changed files with 8 additions and 5 deletions

View File

@ -16,8 +16,10 @@ inputs:
destination-repository-username: destination-repository-username:
description: '[Optional] Username/organization for the destination repository' description: '[Optional] Username/organization for the destination repository'
required: false required: false
default: ''
target-branch: target-branch:
description: '[Optional] set target branch name for the destination repository' description: '[Optional] set target branch name for the destination repository. Defaults to "master"'
default: 'master'
required: false required: false
runs: runs:
using: 'docker' using: 'docker'

View File

@ -1,5 +1,10 @@
#!/bin/sh -l #!/bin/sh -l
set -e # if a command fails it stops the execution
set -u # script fails if trying to access to an undefined variable
echo "Starts" echo "Starts"
FOLDER="$1" FOLDER="$1"
GITHUB_USERNAME="$2" GITHUB_USERNAME="$2"
@ -12,10 +17,6 @@ if [ -z "$REPO_USERNAME" ]
then then
REPO_USERNAME="$GITHUB_USERNAME" REPO_USERNAME="$GITHUB_USERNAME"
fi fi
if [ -z "$TARGET_BRANCH" ]
then
TARGET_BRANCH="master"
fi
CLONE_DIR=$(mktemp -d) CLONE_DIR=$(mktemp -d)