Skip to content

Backup PG

Backup PG #40

Workflow file for this run

name: Backup PG
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * MON'
jobs:
backup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Postgres Dump Backup
uses: tianheg/pg-dump@main
with:
database_url: "postgres://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@${{ secrets.POSTGRES_HOST }}:${{ secrets.POSTGRES_PORT }}/${{ secrets.POSTGRES_DB }}"
postgresql_version: "16"
options: "-O"
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add --all
git commit -m "backup PG db" || true
- name: Push changes
uses: tianheg/github-actions@push
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}