www/.forgejo/workflows/publications.yml
Michał Szczepanik bd7be116b7 ci: inline attribution roles when processing publications
Inlining roles in attribution allows looking up their mappings. This
means that whichever role qualifies as an author attribution (as
opposed to, e.g., a funding attribution) can be expressed in the pool
by declaring a broad mapping. Previously, we relied on a narrow
mapping of an author to be declared in the code.

This is enabled by two changes done elsewhere in recent weeks:

- query-things (former query-research-group): inline-records will no
  longer error when the requested property is not present (1)

- pool-publication-page: publication.py will also work with inlined
  roles; if the role is inlined it will check broad_mappings before
  resorting to a predefined list (2)

One thing to note is that now if attributed_to::roles is not present,
inline-records will drop the entire attribution (instead of keeping it
and inlining just the object). This is inconsequential, as
publication.py would only consider attributions with roles anyway.

(1) e4c9d4498e
(2) 35c21b9123
2026-03-29 20:02:37 +00:00

72 lines
2.2 KiB
YAML

name: Create publication pages
# run daily (5:15 on weekdays) and on manual dispatch
on:
schedule:
- cron: '15 5 * * 1-5'
workflow_dispatch:
env:
POOLAPI: https://pool.v0.trr379.de/api
jobs:
create_pages:
runs-on: debian-latest
if: ${{ forgejo.repository == 'q04/www.trr379.de' }}
steps:
- name: Checkout this
id: websitecheckout
uses: https://hub.datalad.org/forgejo/datalad-clone-action@v1
with:
ref: main
get_file_content: false
recursive: false
- name: Checkout code
id: codecheckout
uses: https://hub.datalad.org/forgejo/datalad-clone-action@v1
with:
repository: q02/pool-publication-page
path: code
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install git-annex
run: uv tool install git-annex
- name: Install qrg & dtc suites
run: |
uv tool install https://hub.psychoinformatics.de/datalink/query-rse-group.git
uv tool install dump-things-pyclient
- name: Configure Git
run: |
git config --global user.name "Forgejo Actions"
git config --global user.email "forgejo-actions@hub.trr379.de"
git config --global credential.helper cache
git credential approve <<EOF
url=${{ forgejo.server_url }}
username=${{ forgejo.actor }}
password=${{ forgejo.token }}
EOF
echo OK
- name: Process metadata
run: |
cd ${{ steps.codecheckout.outputs.path }}
uv sync
mkdir .cache
dtc read-pages ${POOLAPI}/public/records/p/TRR379Person > .cache/Person.jsonl
dtc read-pages ${POOLAPI}/public/records/p/TRR379Publication \
| qrg inline-records --api-url ${POOLAPI}/ -c public -p attributed_to -p attributed_to::roles \
| uv run filters/enrich-via-doi.py --extras - .cache/Person.jsonl - \
| uv run publication.py - ${{ steps.websitecheckout.outputs.path }}/content/publications
- name: Commit and push updates
id: commit
run: |
git add content/publications
git commit -m "Auto-update publications" || true
git push origin