-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (35 loc) · 1.59 KB
/
refresh_data.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
42
43
44
45
name: Refresh data
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *" # every day at midnight
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install
- name: download libraries data using curl
run: curl -o data/libraries.json "https://libraryon.org/cms/api/libraries?pagination[page]=1&pagination[pageSize]=10000&fields=*&populate[services][populate]=*&populate[authority][fields][0]=slug&populate[authority][fields][1]=name&populate[authority][fields][2]=authorityID" -g -H "${{ secrets.LIBRARYON_API_HEADER }}"
- name: download services data using curl
run: curl -o data/services.json "https://api-geography.librarydata.uk/rest/libraryauthorities"
- name: process the data
run: npm run process
- name: Deploy with gh-pages
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npm run deploy -- -u "github-actions-bot <support+actions@github.com>"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: check for changes
run: git status
- name: commit changed files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git diff-index --quiet HEAD || git commit -m "Auto update of data files"
- name: fetch from main
run: git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: push code to main
run: git push origin HEAD:main