Cron Job #330
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
name: Cron Job | |
on: | |
schedule: | |
- cron: "00 13 * * *" | |
workflow_dispatch: | |
jobs: | |
run-cron-job: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
environment: Production – mindful-journal-server | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
TOKEN_KEY: ${{ secrets.TOKEN_KEY }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: npm install | |
working-directory: server | |
- name: Run cron job | |
run: node autoJournalEntries.js | |
working-directory: server/cron | |
- name: Check for success and exit | |
run: | | |
if [ $? -eq 0 ]; then | |
echo "Job completed successfully" | |
exit 0 # Exit the workflow with success code | |
else | |
echo "Job failed!" | |
exit 1 # Exit the workflow with failure code | |
fi |