Skip to content

Fetch data and save data to database, and as csv to github #928

Fetch data and save data to database, and as csv to github

Fetch data and save data to database, and as csv to github #928

Workflow file for this run

name: Fetch data and save data to database, and as csv to github
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 21-23 * * 1-5' # Run every 5 minutes from 16:00 to 18: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: Set branch name
id: branch_name
run: echo ::set-output name=branch_name::daily-branch-$(TZ='America/Toronto' date +'%Y-%m-%d')
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ steps.branch_name.outputs.branch_name }}
- name: Set Up Git
run: git config --global user.email "[email protected]" && git config --global user.name "GitHub Actions"
- 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.js cloud
- name: Commit and Push Changes
run: |
git add .
git commit -m "cron generated data"
git push