From c70c5b84f12b4ddd57581d73800f9f63f3e4c97e Mon Sep 17 00:00:00 2001 From: Patrik Ragnarsson Date: Fri, 24 Jan 2025 00:11:06 +0100 Subject: [PATCH] Use GitHub Actions to ping the preview database Hopefully this makes it so Aiven don't think it is not being used. --- .github/workflows/cron.yml | 14 ++++++++++++++ README.md | 6 ++++++ 2 files changed, 20 insertions(+) create mode 100644 .github/workflows/cron.yml diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml new file mode 100644 index 00000000..214f2e9c --- /dev/null +++ b/.github/workflows/cron.yml @@ -0,0 +1,14 @@ +name: Cron + +on: + schedule: + - cron: "0 6 * * 6" # 06:00 every Saturday + workflow_dispatch: + +jobs: + preview-psql: + runs-on: ubuntu-latest + env: + PREVIEW_DATABASE_URL: "${{ secrets.PREVIEW_DATABASE_URL }}" + steps: + - run: psql --command='SELECT version();' $PREVIEW_DATABASE_URL diff --git a/README.md b/README.md index 470271a1..9c9c3457 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,12 @@ fly secrets set --detach --app wikimum-preview DATABASE_URL="$(pbpaste)" fly secrets set --detach --app wikimum-preview SESSION_SECRET="$(pbpaste)" ``` +To keep the preview database (at Aiven) from being removed prematurely, GitHub Actions has been configured with the `cron.yml` workflow and this secret: + +```bash +gh secret --repo Starkast/wikimum set PREVIEW_DATABASE_URL --body "$(pbpaste)" +``` + ## Code Scanning GitHub Actions scan the code using [Brakeman](https://github.com/presidentbeef/brakeman).