www-from-model/.forgejo/workflows/update_nav_graph.yaml

56 lines
1.6 KiB
YAML

name: Update navigation graph
on:
schedule:
- cron: '0 2 * * 1-5'
workflow_dispatch:
env:
DUMPTHINGS_APIURL: https://pool.psychoinformatics.de/api
jobs:
update_nav_graph:
runs-on: debian-latest
if: ${{ forgejo.repository == 'www/www-from-model' }}
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Prepare environment
uses: ./.forgejo/actions/prep-metadata-query
- name: git-annex init
run: |
git fetch --depth 1 origin git-annex:git-annex
git config --add annex.private true
git annex init
#- name: Debug
# run: |
# cat << EOT > /usr/local/bin/git-credential-echo
# #!/usr/bin/env bash
# exec cat >&2
# EOT
# chmod +x /usr/local/bin/git-credential-echo
# git config --global credential.helper echo
- name: Update graph
run: |
set -x
git config --global credential.helper cache
git credential approve <<EOF
protocol=https
host=hub.psychoinformatics.de
username=${{ forgejo.actor }}
password=${{ forgejo.token }}
EOF
echo OK
git credential fill <<EOF
protocol=https
host=hub.psychoinformatics.de
EOF
dtc get-records ${DUMPTHINGS_APIURL} public \
| python3 code/pool2graph.py > static/graph.json_new \
&& mv static/graph.json_new static/graph.json \
&& git annex add static
git annex push
git annex push --cleanup
- name: Deposit changes
uses: ./.forgejo/actions/deposit-changes