-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (36 loc) · 1.47 KB
/
fetch_data.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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