mirror of
https://github.com/f/awesome-chatgpt-prompts.git
synced 2026-02-12 15:52:47 +00:00
feat(api): add daily generation credits reset cron job and user settings
This commit is contained in:
29
.github/workflows/reset-credits.yml
vendored
Normal file
29
.github/workflows/reset-credits.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
name: Reset Daily Generation Credits
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Run at midnight UTC every day
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
reset-credits:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Reset daily generation credits
|
||||
run: |
|
||||
response=$(curl -s -w "\n%{http_code}" -X POST \
|
||||
"https://prompts.chat/api/cron/reset-credits" \
|
||||
-H "Authorization: Bearer ${{ secrets.CRON_SECRET }}")
|
||||
|
||||
http_code=$(echo "$response" | tail -n1)
|
||||
body=$(echo "$response" | sed '$d')
|
||||
|
||||
echo "Response: $body"
|
||||
echo "HTTP Code: $http_code"
|
||||
|
||||
if [ "$http_code" != "200" ]; then
|
||||
echo "Failed to reset credits"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Credits reset successfully"
|
||||
Reference in New Issue
Block a user