Skip to content

Commit b19399d

Browse files
committed
make force push optional
1 parent 5d25d49 commit b19399d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ inputs:
1313
gitlab_pat:
1414
description: 'Your GitLab Personal Access Token with required permissions'
1515
required: true
16+
force_push:
17+
description: 'Whether to force push to GitLab. Defaults to false.'
18+
required: false
19+
default: 'false'
1620
runs:
1721
using: 'composite'
1822
steps:
@@ -28,5 +32,9 @@ runs:
2832
gitlab_repo_url_with_credentials="https://${{ inputs.username }}:${{ inputs.gitlab_pat }}@${gitlab_repo_url}"
2933
git remote add gitlab "$gitlab_repo_url_with_credentials"
3034
branch_name=$(echo $GITHUB_REF | sed 's/refs\/heads\///')
31-
git push gitlab "$branch_name" --force
35+
push_command="git push gitlab $branch_name"
36+
if [[ "${{ inputs.force_push }}" == "true" ]]; then
37+
push_command="$push_command --force"
38+
fi
39+
$push_command
3240
shell: bash

0 commit comments

Comments
 (0)