Skip to content

Commit 0c6f91a

Browse files
Back up entire repo
(instead of only main branch)
1 parent ef4ad6d commit 0c6f91a

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

.github/workflows/gdrive_backup.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,16 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- name: Checkout all branches
14-
uses: actions/checkout@v4
15-
with:
16-
fetch-depth: 0 # Fetch all history for all branches
17-
1813
- name: Set backup filename
1914
run: echo "BACKUP_FILE=$(echo \"${{ github.repository }}-backup-$(date +%F).tar.gz\" | sed 's/\//-/g')" >> $GITHUB_ENV
2015

16+
- name: Clone the repository (mirror all branches and history)
17+
run: |
18+
git clone --mirror https://github.com/${{ github.repository }}.git repo-mirror
19+
2120
- name: Create backup archive
2221
run: |
23-
tar --exclude='.git' \
24-
--exclude='.github' \
25-
--exclude='credentials.json' \
26-
--exclude="$BACKUP_FILE" \
27-
--warning=no-file-changed \
28-
-czf "$BACKUP_FILE" . || [ $? -eq 1 ]
22+
tar -czvf "$BACKUP_FILE" repo-mirror
2923
3024
- name: Check if backup archive exists
3125
run: |
@@ -61,5 +55,6 @@ jobs:
6155
6256
- name: Clean up
6357
run: |
58+
rm -rf repo-mirror
6459
rm -f "$BACKUP_FILE"
6560
rm -f credentials.json

0 commit comments

Comments
 (0)