* Add force with lease support

* Update the documentation
This commit is contained in:
Pascal Zimmermann
2022-05-05 06:27:49 +02:00
parent 492de9080c
commit e5f70b0f07
3 changed files with 52 additions and 11 deletions

View File

@@ -2,6 +2,7 @@
set -e
INPUT_FORCE=${INPUT_FORCE:-false}
INPUT_FORCE_WITH_LEASE=${INPUT_FORCE_WITH_LEASE:-false}
INPUT_SSH=${INPUT_SSH:-false}
INPUT_TAGS=${INPUT_TAGS:-false}
INPUT_DIRECTORY=${INPUT_DIRECTORY:-'.'}
@@ -14,9 +15,18 @@ echo "Push to branch $INPUT_BRANCH";
exit 1;
};
if ${INPUT_FORCE} && ${INPUT_FORCE_WITH_LEASE}; then
echo 'Please, specify only force or force_with_lease and not both.';
exit 1;
fi
if ${INPUT_FORCE}; then
_FORCE_OPTION='--force'
fi
_FORCE_OPTION='--force'
fi
if ${INPUT_FORCE_WITH_LEASE}; then
_FORCE_OPTION='--force-with-lease'
fi
if ${INPUT_TAGS}; then
_TAGS='--tags'
@@ -32,4 +42,9 @@ fi
git config --local --add safe.directory ${INPUT_DIRECTORY}
git push "${remote_repo}" HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION $_TAGS;
if ${INPUT_FORCE_WITH_LEASE}; then
git push --follow-tags $_FORCE_OPTION $_TAGS;
else
git push "${remote_repo}" HEAD:${INPUT_BRANCH} --verbose --follow-tags $_FORCE_OPTION $_TAGS;
fi