File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ GitHub Action for backup your git repository.
1818
1919- ` GIT_DEPLOY_KEY ` : ** Required** , your deploy key (ssh private key) which has ** Write access**
2020- ` TARGET_GIT ` : ** required** , your backup git repository (please use ssh or git protocol)
21- - ` BRANCH ` : ** required ** , the branch you want to backup
21+ - ` BRANCH ` : ** optional ** , the branch you want to backup (default value is ` master ` )
2222
2323```
2424name: Backup Git Repository
Original file line number Diff line number Diff line change @@ -12,13 +12,13 @@ git config --global --add safe.directory /github/workspace
1212
1313git version
1414git fetch --unshallow origin
15- git checkout ${BRANCH}
15+ git checkout ${BRANCH:- master }
1616git status
1717git remote add backup ${TARGET_GIT}
1818git remote -vv
1919git config --global --add safe.directory /github/workspace
2020git config --global user.name " ${GITHUB_ACTOR} "
2121git config --global user.email " ${GITHUB_ACTOR} @users.noreply.github.com"
2222echo ' ready to push'
23- git push backup ${BRANCH} -f
23+ git push backup ${BRANCH:- master } -f
2424git remote remove backup
You can’t perform that action at this time.
0 commit comments