GitHub and CI
Run a checkup in GitHub Actions. Read the findings in the run. Fail a build when something gets worse. DATABASE_URL stays in your repository secrets.
Quickest: the template
Create a repository from pgcheckup/checkup-template, add a DATABASE_URL secret, and run the workflow. Findings appear under the run. Each run is compared with the last.
Connect GitHub from the site
Open /ci:
- Connect GitHub. Let the PG Checkup app see your repositories.
- Pick a private repository. Public ones are refused, because their reports would be public.
- Add the workflow. The page shows the exact file it writes to
.github/workflows/pg-checkup.yml. - Add
DATABASE_URLas a repository secret. The page links to the right screen. - Press Run. The report opens here when it finishes.
You get 3 free runs. Workspace ($5 a month) adds unlimited runs, a daily or weekly schedule, saved reports and email alerts.
The app can write one workflow file and one secret. It cannot read secrets. Uninstall it on GitHub to remove access.
Private certificates. If the runner cannot verify the database certificate, it retries once with encryption but no verification, and says so. Add sslmode=verify-full to forbid that.
In your own workflow
- uses: pgcheckup/checkup-action@v1
with:
database-url: ${{ secrets.DATABASE_URL }}
fail-on: warning # optional
Or generate the whole file:
npx pg-checkup schedule --summary --write
The last run is kept in the Actions cache, which GitHub clears after 7 days unused. A weekly schedule keeps it.
Save runs to your account (Workspace)
npx pg-checkup schedule --write
Add two secrets:
DATABASE_URL: the connection string.PGCHECKUP_TOKEN: create it in Settings. It can only add reports.
Each upload is compared with the last one for the same database.
Alerts
With a token, you get one email when a new warning or critical finding appears, a finding gets worse, something runs out within 30 days, or scheduled runs stop. Turn alerts off in Settings.
cron
npx pg-checkup schedule --cron
Prints one crontab line. Set DATABASE_URL and PGCHECKUP_TOKEN on that machine.
Fail a build
npx pg-checkup --fail-on warning --no-input -o checkup.json
Exit codes: 0 done, 1 --fail-on match, 2 error, 3 login has too much access (with --require-reader-role), 4 files are from different databases. --strict also exits 1 when a view could not be read.
Compare two runs
npx pg-checkup compare before.json after.json
Lists what was fixed, what is new and what is still open. Exits 1 on a regression.
GitHub-hosted runners change IP addresses. If your database only accepts listed addresses, use a self-hosted runner.