-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable */ | ||
|
||
print( | ||
db.users | ||
.find({}) | ||
.sort({ lastAccessed: 1 }) | ||
.project({ _id: 0, created: 1, lastAccessed: 1, updatedAt: 1 }) | ||
) | ||
|
||
db.sessions.deleteMany({ }) | ||
db.users.deleteMany({ }) |