Skip to content

Refresh data

Refresh data #227

Workflow file for this run

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