Skip to content

fetch_zotero

fetch_zotero #36

Workflow file for this run

# This workflow is used to update the Zotero information that populates the
# publication lists on the website.
#
# When: this workflow is run when ever a commit is pushed to the `main` or
# `test_actions` branches
#
# What: This workflow uses wget to fetch data from Zotero and store it in a format
# that will be used automatically by Jekyll when processing pages
#
# Requirements: For this action to work, there must be a secret key that
# authorizes access to the Zotero data through its API.
# You can learn more about such OAuth keys here:
# https://www.zotero.org/settings/keys/new
# This key should be stored as `secrets.ZOTERO_GH_TOKEN`
name: fetch_zotero
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main, test_actions ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: '0 6 * * 0'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
fetch_pubs:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs wget to interact with Zotero API
- name: Fetch publication list from Zotero API
run: |
wget --header="Zotero-API-Key: ${{ secrets.ZOTERO_GH_TOKEN }}" -O _data/pub.json 'https://api.zotero.org/groups/10058/collections/UKXV4KID/items?format=json&include=data,bibtex&itemType=-attachment&sort=date&limit=100'
- name: Fetch thesis list from Zotero API
run: |
wget --header="Zotero-API-Key: ${{ secrets.ZOTERO_GH_TOKEN }}" -O _data/theses.json 'https://api.zotero.org/groups/10058/collections/6259B6TV/items?format=json&include=data,bibtex&itemType=-attachment&sort=date&limit=100'
- name: Add datestamp
run: date > _data/zotero.datestamp
- name: Commit files # transfer the new html files back into the repository
run: |
ls _data
git config --local user.name "CNERG Zotero Bot"
git add _data/pub.json _data/theses.json _data/zotero.datestamp
git commit -m "Updating the publication data from Zotero"
- name: Push changes # push the output folder to your repo
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true