update-subjects-from-table/action.yml

46 lines
1.4 KiB
YAML

name: Generate and submit updated subject records from a TSV table
description: TODO
inputs:
study-pid:
required: true
default: ""
description: PID of the study associated with the TSV table. Should match a corresponding study record in the knowledge pool.
jwt-audience-claim:
required: true
default: ""
description: Audience claim used to request the Forgejo JWT used for knowledge pool submission.
tsv-file:
required: true
default: ""
description: Path to the TSV file containing subject rows within the repository.
options:
required: false
default: ""
description: Additional command-line options forwarded to `update_subject_records.py`.
runs:
using: composite
steps:
- name: Fetch knowledge pool token
id: jwt
uses: https://hub.trr379.de/actions/fetch-forgejo-jwt@v1
with:
audience: ${{ inputs.jwt-audience-claim }}
- name: Submit records
shell: bash
env:
ACTION_PATH: ${{ forgejo.action_path }}
DTC_TOKEN: ${{ steps.jwt.outputs.jwt }}
STUDY_PID: ${{ inputs.study-pid }}
TSV_FILE: ${{ inputs.tsv-file }}
OPTIONS: ${{ inputs.options }}
run: |
set -euo pipefail
file_blob_sha=$(git rev-parse HEAD:${TSV_FILE})
uv run --quiet "${ACTION_PATH}/update_subject_records.py" \
${OPTIONS} \
"${STUDY_PID}" \
"dldi:${file_blob_sha}" \
"${TSV_FILE}"