Fetch data and save to database #41
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: Fetch data and save to database | |
on: | |
workflow_dispatch: | |
schedule: # if scheduled on the hour, job might be skipped due to runner high workload | |
- cron: '10-59/5 13-15 * * 1-5' # Run every 5 minutes from 08:00 to 10:00, minutes 10 to 59, Eastern Time on weekdays (Monday to Friday) | |
- cron: '10-59/5 22-23,0 * * 1-5' # Run every 5 minutes from 17:00 to 19:00, minutes 10 to 59, Eastern Time on weekdays (Monday to Friday) | |
jobs: | |
run-script: | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
env: | |
CLOUD_PSQL_USERNAME: ${{ secrets.CLOUD_PSQL_USERNAME }} | |
CLOUD_PSQL_PASSWORD: ${{ secrets.CLOUD_PSQL_PASSWORD }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: npm install | |
- name: Run Node.js script | |
run: node query_cloud.js | |