-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (29 loc) · 942 Bytes
/
fetch.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
# github action to run `fetch` task using npm and commit changes
name: Run Fetch Task and Commit Data
on:
schedule:
- cron: "0 * * * *" # Runs every hour at the beginning of the hour
workflow_dispatch:
jobs:
fetch_task:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "20"
- name: Install dependencies
run: npm install
- name: Run fetch task
run: npm run fetch
- name: Commit and push if there are changes
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git add src/data/*
git commit -m "Automated data update" -a || echo "No changes to commit"
git push
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}