Backup DB #195
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Backup DB | |
| on: | |
| schedule: | |
| # Everyday at 18:30 UTC (Midnight in Asia/Kolkata timezone) | |
| - cron: "30 18 * * *" | |
| jobs: | |
| backup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: curl "${{ secrets.BASE_URL }}/api/backup" --request POST --create-dirs --output backup/data.json.gz | |
| - run: | | |
| git config --local user.email "abhayvashokan@gmail.com" | |
| git config --local user.name "Abhay V Ashokan" | |
| git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" | |
| git add -A | |
| if [[ -n $(git status --porcelain) ]]; then | |
| git commit -m "Backup $(date +%F)" | |
| git push --no-verify | |
| fi |