Scheduled Data Fetch and Update #33
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: Scheduled Data Fetch and Update | |
on: | |
schedule: | |
- cron: "0 0 * * *" # Runs every day at midnight | |
jobs: | |
update-repo: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout your repository | |
- name: Update Catalog | |
uses: actions/checkout@v3 | |
# Set up Node.js environment | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "23" | |
# Install dependencies | |
- name: Install dependencies | |
run: npm install | |
# Run Node.js script to fetch data and update repository | |
- name: Run data fetch script | |
run: node updateCatalog.js | |
# Commit and push changes back to your repository | |
- name: Commit changes | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Update repository with fetched data" | |
git push https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/epiverse/catalog.git HEAD:main |