Skip to content

Commit

Permalink
chore(ci): reset users midnight utc
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneRifle committed Sep 5, 2024
1 parent b48396c commit 85bf9f5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/reset-users.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Reset users

on:
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 * * *'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v4
- name: 🍃 Install mongosh
run: |
sudo apt-get update
sudo apt-get install -y wget gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt-get update
sudo apt-get install -y mongodb-mongosh
- name: Reset mongo
env:
DB_URI: ${{ secrets.DB_URI }}
run: |
mongosh -f bin/reset-users.mongodb.js $DB_URI
4 changes: 4 additions & 0 deletions bin/reset-users.mongodb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* eslint-disable */

db.sessions.deleteMany({ })
db.users.deleteMany({ })

0 comments on commit 85bf9f5

Please sign in to comment.