Skip to content

Commit

Permalink
support to set branch
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxSuRen committed Nov 16, 2022
1 parent 60b8c72 commit b332146
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ GitHub Action for backup your git repository.

## Environment Variables

- `GIT_DEPLOY_KEY` - *Required* your deploy key (ssh private key) which has **Write access**
- `TARGET_GIT` : **required**, your backup git repository (please use ssh or git protocol)
- `GIT_DEPLOY_KEY`: **Required**, your deploy key (ssh private key) which has **Write access**
- `TARGET_GIT`: **required**, your backup git repository (please use ssh or git protocol)
- `BRANCH`: **required**, the branch you want to backup

```
name: Backup Git Repository
Expand All @@ -37,4 +38,5 @@ jobs:
env:
GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}
TARGET_GIT: "[email protected]:surenpi/surenpi.git"
BRANCH: master
```
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ git config --global --add safe.directory /github/workspace

git version
git fetch --unshallow origin
git checkout master
git checkout ${BRANCH}
git status
git remote add backup ${TARGET_GIT}
git remote -vv
git config --global --add safe.directory /github/workspace
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
echo 'ready to push'
git push backup master -f
git push backup ${BRANCH} -f
git remote remove backup

0 comments on commit b332146

Please sign in to comment.