Skip to content

Commit 84313b0

Browse files
committed
Add force push if set in environment
1 parent 75d5778 commit 84313b0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
with:
2424
args: "https://gitlab.com/<namespace>/<repository>"
2525
env:
26+
FORCE_PUSH: "true"
2627
GITLAB_HOSTNAME: "gitlab.com"
2728
GITLAB_USERNAME: "svboxel"
2829
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }} // Generate here: https://gitlab.com/profile/personal_access_tokens

entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ sh -c "git config --global core.askPass /cred-helper.sh"
3131
sh -c "git config --global credential.helper cache"
3232
sh -c "git remote add mirror $*"
3333
sh -c "echo pushing to $branch branch at $(git remote get-url --push mirror)"
34+
if ["$FORCE_PUSH" = "true"]
35+
then
36+
sh -c "git push --force mirror $branch"
37+
else
3438
sh -c "git push mirror $branch"
39+
fi
3540

3641
sleep $POLL_TIMEOUT
3742

0 commit comments

Comments
 (0)