Merge pull request #34 from Woile/master

Make tags optional
This commit is contained in:
Oliver Kopp 2020-01-02 07:45:51 +01:00 committed by GitHub
commit 19caa5c351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -41,6 +41,7 @@ jobs:
| github_token | string | | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}`. |
| branch | string | 'master' | Destination branch to push changes. |
| force | boolean | false | Determines if force push is used. |
| tags | boolean | false | Determines if `--tags` is used. |
| directory | string | '.' | Directory to change to before pushing. |
| repository | string | '' | Repository name. Default or empty repository name represents current github repository. If you want to push to other repository, you should make a [personal access token](https://github.com/settings/tokens) and use it as the `github_token` input. |

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;
git push "${remote_repo}" HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION $_TAGS;