Skip to content

Commit 7dc8490

Browse files
authored
fix: updated workflow for backup (#52)
1 parent f1088a3 commit 7dc8490

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

.github/workflows/backup.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ jobs:
2828
set -e
2929
3030
echo "Dumping specific databases..."
31-
mongodump --uri "${{ secrets.MONGODB_URI }}" --db test --out ./temp_backup
31+
mongodump --uri "${{ secrets.MONGODB_URI }}" --db pbctf --out ./temp_backup
3232
3333
TIMESTAMP=$(date -u +%Y-%m-%dT%H-%M-%SZ)
3434
3535
echo "Restoring databases..."
36-
mongorestore --uri "${{ secrets.BACKUP_URI }}" --db "test-$TIMESTAMP" --drop ./temp_backup/test
36+
mongorestore --uri "${{ secrets.BACKUP_URI }}" --nsFrom="pbctf.*" --nsTo="pbctf-$TIMESTAMP.*" --drop ./temp_backup
3737
3838
echo "Backup completed successfully for $TIMESTAMP"
3939
@@ -43,7 +43,7 @@ jobs:
4343
const maxBackups = parseInt(process.env.MAX_BACKUPS);
4444
4545
// Cleanup
46-
const testBackups = dbs.filter(name => name.startsWith("test-")).sort();
46+
const testBackups = dbs.filter(name => name.startsWith("pbctf-")).sort();
4747
if (testBackups.length > maxBackups) {
4848
const backupsToDelete = testBackups.slice(0, testBackups.length - maxBackups);
4949
backupsToDelete.forEach(dbName => {
@@ -58,4 +58,4 @@ jobs:
5858
- name: Clean up local files
5959
if: always()
6060
run: |
61-
rm -rf ./temp_backup
61+
rm -rf ./temp_backup

0 commit comments

Comments
 (0)