Add simple force input
This commit is contained in:
parent
70ea6b82bf
commit
ed911a0e24
@ -12,6 +12,9 @@ inputs:
|
||||
description: 'Destination branch to push changes'
|
||||
required: false
|
||||
default: 'master'
|
||||
force:
|
||||
description: 'Determines if force push is used'
|
||||
required: false
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
image: 'Dockerfile'
|
||||
|
13
start.sh
13
start.sh
@ -1,9 +1,18 @@
|
||||
#!/bin/sh
|
||||
echo "Push to branch ${INPUT_BRANCH:=master}";
|
||||
|
||||
INPUT_BRANCH:='master'
|
||||
INPUT_FORCE:=false
|
||||
_FORCE_OPTION=''
|
||||
|
||||
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
|
||||
|
||||
header=$(echo -n "ad-m:${INPUT_GITHUB_TOKEN}" | base64)
|
||||
git -c http.extraheader="AUTHORIZATION: basic $header" push origin HEAD:${INPUT_BRANCH} --follow-tags;
|
||||
git -c http.extraheader="AUTHORIZATION: basic $header" push origin HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION;
|
||||
|
Loading…
x
Reference in New Issue
Block a user