From 049727e6e6655c56c26eb58f0a46a55db9a96770 Mon Sep 17 00:00:00 2001 From: Venkata Mutyala Date: Sun, 13 Aug 2023 17:47:45 -0700 Subject: [PATCH] fix: github backup script (#12) * fix: github backup script * Update image.yaml * Update github-backup.sh * Update github-backup.sh * Update github-backup.sh * Update github-backup.sh * Update README.md --- .github/workflows/image.yaml | 2 +- README.md | 2 +- github-backup.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml index ed9d417..b91ab5c 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/image.yaml @@ -7,4 +7,4 @@ jobs: runs-on: ubuntu-latest steps: - name: Build, Tag and Push Docker Image to GHCR - uses: GlueOps/github-actions-build-push-containers@v0.1.1 + uses: GlueOps/github-actions-build-push-containers@v0.1.3 diff --git a/README.md b/README.md index 8752344..adfd883 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ export GITHUB_TOKEN="" # GitH needs to have read access to all repositories with ```bash docker build . -t backup && docker run -it backup # Export ALL the variables required as mentioned in this README.md and then run: -./github-backup.sh +backup-github ``` # Google Drive Shared Drive Backups diff --git a/github-backup.sh b/github-backup.sh index a1fe286..aa5989f 100755 --- a/github-backup.sh +++ b/github-backup.sh @@ -20,11 +20,11 @@ BACKUP_LOCATION="github.com/$BACKUP_DATE/$GITHUB_ORG_TO_BACKUP" mkdir -p $BACKUP_LOCATION && cd $BACKUP_LOCATION for repo in $repos; do - gh repo clone https://github.com/$repo.git -- --mirror + git clone --mirror https://$GITHUB_TOKEN@github.com/$repo.git repo_name="${repo##*/}" tar -czf "${repo_name}.tar.gz" "${repo_name}.git" && rm -rf "${repo_name}.git" done echo "Uploading everything to S3...." cd /app -aws s3 cp --recursive github.com/ s3://${S3_BUCKET_NAME}/github.com/ \ No newline at end of file +aws s3 cp --recursive github.com/ s3://${S3_BUCKET_NAME}/github.com/