Skip to content

Run Fetch Task and Commit Data #2906

Run Fetch Task and Commit Data

Run Fetch Task and Commit Data #2906

Workflow file for this run

# 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 }}