Skip to content

[IIIF Upload]: Lost uploaded letters: letter_0021-0062, 0153, 0156 #336

[IIIF Upload]: Lost uploaded letters: letter_0021-0062, 0153, 0156

[IIIF Upload]: Lost uploaded letters: letter_0021-0062, 0153, 0156 #336

name: Upload IIIF images to Transkribus based on IIIF manifests
on:
issues:
types: [opened, edited]
issue_comment:
types: [created, edited]
jobs:
evaluate-label:
name: evaluate-label
runs-on: ubuntu-latest
env:
TASKS: ${{ join(github.event.issue.labels.*.name,', ') }}
CONTINUE: ${{ contains(join(github.event.issue.labels.*.name,', '),'task:iiif-upload') && contains(fromJson(vars.WHITELIST),github.actor) && 'true' || 'false'}}
outputs:
continue: ${{ env.CONTINUE }}
steps:
- run: echo ${{ env.CONTINUE }}
run:
name: run
runs-on: ubuntu-latest
needs: evaluate-label
if: needs.evaluate-label.outputs.continue == 'true'
outputs:
output1: ${{ steps.ipynb-txt.outputs.out }}
env:
TASKS: ${{ join(github.event.issue.labels.*.name,', ') }}
steps:
- run: echo ${{join(github.event.issue.labels.*.name,', ')}}
- run: echo env.TASKS
- uses: actions/checkout@v4
- uses: stefanbuck/github-issue-parser@v3
id: issue-parser
with:
template-path: .github/ISSUE_TEMPLATE/0-initiate-upload.yml
- run: cat ${HOME}/issue-parser-result.json
- run: cp ${HOME}/issue-parser-result.json ./issue-parser-result.json
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: yaananth/run-notebook@v2
id: ipynb
env:
RUNNER: ${{ toJson(runner) }}
SECRETS: ${{ toJson(secrets) }}
GITHUB: ${{ toJson(github) }}
ISSUE: ./issue-parser-result.json
with:
notebook: "./iiif-to-transkribus/iiif-to-transkribus.ipynb"
params: "./iiif-to-transkribus/default-params.json"
isReport: False
poll: True
# for easier debugging:
- uses: actions/upload-pages-artifact@v3
# if: always()
with:
name: output
path: ${{ RUNNER.temp }}/nb-runner
env:
RUNNER: ${{ toJson(runner) }}
# output for auto reply
- name: Read notebook capture into a github actions output
id: ipynb-txt
run: |
{
echo 'out<<DELIM'
cat ./ipynb.txt
echo
echo DELIM
} >> "$GITHUB_OUTPUT"
# adding a reply to the issue thread
add-comment:
needs: run
runs-on: ubuntu-latest
env:
TASKS: ${{ join(github.event.issue.labels.*.name,', ') }}
permissions:
issues: write
steps:
- name: Add comment
# run: gh issue comment "$NUMBER" --body-file ./ipynb.txt
run: gh issue comment "$NUMBER" --body "$BODY"
env:
OUTPUT1: ${{needs.run.outputs.output1}}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
BODY: ${{needs.run.outputs.output1}}
# adding a reply to the issue thread in case of non-authorization
add-comment-unauthorized:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Add comment
if: ${{ ! contains(fromJson(vars.WHITELIST),github.actor)}}
run: gh issue close "$NUMBER" -c "$BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
BODY: "**Initiator of the action (${{ github.actor }}) is not whitelisted.**\n\n **Aborting.**\n\n\n [Edit `WHITELIST`](https://github.com/organizations/dse-as/settings/variables/actions/WHITELIST)"