Skip to content

Sync JSON Data

Sync JSON Data #5

name: Sync JSON Data
on:
schedule:
# This schedule will run every day at midnight UTC (modify as needed)
- cron: '0 * * * *'
workflow_dispatch: # Allows manual trigger
permissions:
contents: write
jobs:
sync-json:
runs-on: ubuntu-latest
steps:
- name: Checkout πŸ›Ž
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.KEY_UPDATE_LAWS_DATA }} # Ensure that this SSH key has proper permissions
- name: Setup node env πŸ—
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
- name: Install dependencies πŸ‘¨πŸ»β€πŸ’»
run: yarn --ignore-engines
- name: Fetch data πŸƒπŸ»β€β™‚οΈ
run: |
curl -s "https://script.google.com/macros/s/${{ secrets.KEY_APP_SCRIPT }}/exec?action=getData" -o data/laws.json
- name: Commit and Push Changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add data/laws.json
git commit -m "Sync JSON data from Google Apps Script"
git push origin HEAD:refs/heads/main