-
Notifications
You must be signed in to change notification settings - Fork 4
41 lines (33 loc) · 1.14 KB
/
sync-app-script.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
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