feat: tags is now configurable

This commit is contained in:
Santiago Fraire Willemoës 2019-11-22 12:30:46 +01:00
parent dbccd851c4
commit 508672e3d6
2 changed files with 9 additions and 1 deletions

View File

@ -19,6 +19,9 @@ inputs:
force:
description: 'Determines if force push is used'
required: false
tags:
description: 'Determines if --tags is used'
required: false
directory:
description: 'Directory to change to before pushing.'
required: false

View File

@ -3,6 +3,7 @@ set -e
INPUT_BRANCH=${INPUT_BRANCH:-master}
INPUT_FORCE=${INPUT_FORCE:-false}
INPUT_TAGS=${INPUT_TAGS:-false}
INPUT_DIRECTORY=${INPUT_DIRECTORY:-'.'}
_FORCE_OPTION=''
REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY}
@ -17,8 +18,12 @@ if ${INPUT_FORCE}; then
_FORCE_OPTION='--force'
fi
if ${TAGS}; then
_TAGS='--tags'
fi
cd ${INPUT_DIRECTORY}
remote_repo="https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${REPOSITORY}.git"
git push "${remote_repo}" HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION --tags;
git push "${remote_repo}" HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION $_TAGS;