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).