Harvest from DOI #1286
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Harvest from DOI | |
on: | |
workflow_dispatch: | |
inputs: | |
doi: | |
description: 'DOI or multiple DOIs (separated by a space) to harvest from' | |
required: true | |
tag: | |
description: '@ tag to include in submission for queue view' | |
required: true | |
default: 'new' | |
jobs: | |
prepare-dois: | |
name: Prepare Matrix Output of DOIs | |
runs-on: ubuntu-24.04 | |
outputs: | |
dois: ${{ steps.step1.outputs.matrix }} | |
env: | |
DOI: ${{ github.event.inputs.doi }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Process DOIs | |
shell: bash | |
run: python split_doi.py >> $GITHUB_OUTPUT | |
id: step1 | |
harvest: | |
runs-on: ubuntu-24.04 | |
needs: [prepare-dois] | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
doi: ${{ fromJSON(needs.prepare-dois.outputs.dois) }} | |
outputs: | |
dois: ${{ steps.step1.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Python Deps | |
shell: bash | |
run: pip install -r requirements.txt --break-system-packages | |
- name: Make downloads folder | |
shell: bash | |
run: mkdir $HOME/Downloads | |
- name: Install irdmtools | |
shell: bash | |
run: curl https://caltechlibrary.github.io/irdmtools/installer.sh | sh | |
- name: Path | |
shell: bash | |
run: cp $HOME/bin/doi2rdm $HOME/.local/bin/. | |
- name: Harvest DOIs | |
shell: bash | |
env: | |
RDMTOK: ${{ secrets.RDMTOK }} | |
DIMKEY: ${{ secrets.DIMKEY }} | |
id: harvest | |
run: python harvest.py doi -doi "${{matrix.doi}}" -actor ${{github.actor}} -tag ${{ github.event.inputs.tag }} >> $GITHUB_OUTPUT | |
- uses: cloudposse/github-action-matrix-outputs-write@main | |
id: out | |
with: | |
matrix-step-name: ${{ github.job }} | |
matrix-key: ${{ matrix.doi }} | |
outputs: |- | |
doi: ${{ steps.harvest.outputs.doi }} | |
error: ${{steps.harvest.outputs.error }} | |
- name: System error on DOI | |
if: contains(steps.harvest.outputs.error, 'system') | |
run: | | |
echo ${{steps.harvest.outputs.error}} | |
false | |
- name: System intentionally skipped DOI | |
if: contains(steps.harvest.outputs.error, 'skipping') | |
run: | | |
echo ${{steps.harvest.outputs.error}} | |
false | |
- name: DOI not yet in Crossref or DataCite | |
if: contains(steps.harvest.outputs.error, 'not found') | |
run: | | |
echo ${{steps.harvest.outputs.error}} | |
false | |
write-output: | |
name: Write Output | |
runs-on: ubuntu-24.04 | |
needs: [harvest] | |
outputs: | |
result: "${{ steps.read.outputs.result }}" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: read | |
uses: cloudposse/github-action-matrix-outputs-read@main | |
id: read | |
with: | |
matrix-step-name: harvest | |
- name: write DOI | |
run: | | |
python save_dois.py '${{steps.read.outputs.result}}' | |
- name: Commit File | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: 'Update harvested_dois.txt' | |
add: "['harvested_dois.txt']" | |
report-status: | |
name: Report Status | |
runs-on: ubuntu-24.04 | |
needs: [write-output] | |
outputs: | |
result: "${{ steps.read.outputs.result }}" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: read | |
uses: cloudposse/github-action-matrix-outputs-read@main | |
id: read | |
with: | |
matrix-step-name: harvest | |
- name: System error on DOI | |
run: | | |
python check_status.py '${{steps.read.outputs.result}}' |