abroskin 6defe3bd9f
Added workaround as suggested by the git itself (#112)
* Added workaround as suggested by the git itself

* Update start.sh

Co-authored-by: Pascal Zimmermann <Z_pascal@yahoo.de>

Co-authored-by: aleksandr.abroskin <aleksandr.abroskin@getmoss.com>
Co-authored-by: Adam Dobrawy <ad-m@users.noreply.github.com>
Co-authored-by: Pascal Zimmermann <Z_pascal@yahoo.de>
2022-04-15 01:32:33 +02:00

31 lines
712 B
Bash
Executable File

#!/bin/sh
set -e
INPUT_FORCE=${INPUT_FORCE:-false}
INPUT_TAGS=${INPUT_TAGS:-false}
INPUT_DIRECTORY=${INPUT_DIRECTORY:-'.'}
_FORCE_OPTION=''
REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY}
echo "Push to branch $INPUT_BRANCH";
[ -z "${INPUT_GITHUB_TOKEN}" ] && {
echo 'Missing input "github_token: ${{ secrets.GITHUB_TOKEN }}".';
exit 1;
};
if ${INPUT_FORCE}; then
_FORCE_OPTION='--force'
fi
if ${INPUT_TAGS}; then
_TAGS='--tags'
fi
cd ${INPUT_DIRECTORY}
remote_repo="https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${REPOSITORY}.git"
git config --local --add safe.directory ${INPUT_DIRECTORY}
git push "${remote_repo}" HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION $_TAGS;