Skip to content

Commit b332146

Browse files
committed
support to set branch
1 parent 60b8c72 commit b332146

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ GitHub Action for backup your git repository.
1616

1717
## Environment Variables
1818

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

2223
```
2324
name: Backup Git Repository
@@ -37,4 +38,5 @@ jobs:
3738
env:
3839
GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}
3940
TARGET_GIT: "[email protected]:surenpi/surenpi.git"
41+
BRANCH: master
4042
```

entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ git config --global --add safe.directory /github/workspace
1212

1313
git version
1414
git fetch --unshallow origin
15-
git checkout master
15+
git checkout ${BRANCH}
1616
git status
1717
git remote add backup ${TARGET_GIT}
1818
git remote -vv
1919
git config --global --add safe.directory /github/workspace
2020
git config --global user.name "${GITHUB_ACTOR}"
2121
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
2222
echo 'ready to push'
23-
git push backup master -f
23+
git push backup ${BRANCH} -f
2424
git remote remove backup

0 commit comments

Comments
 (0)