generated from caltechlibrary/template
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (140 loc) · 4.23 KB
/
dimensions.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Harvest from Dimensions
on:
schedule:
- cron: '10 15 * * 1-5'
workflow_dispatch:
inputs:
reason:
description: 'Reason'
required: false
default: 'Manual trigger'
jobs:
get-dimensions:
runs-on: ubuntu-24.04
outputs:
dois: ${{ steps.harvest.outputs.dois }}
message: ${{ steps.harvest.outputs.message }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Python Deps
shell: bash
run: pip install -r requirements.txt --break-system-packages
- name: Harvest DOIs
shell: bash
env:
DIMKEY: ${{ secrets.DIMKEY }}
id: harvest
run: python harvest.py dimensions -actor ${{github.actor}} -print >> $GITHUB_OUTPUT
prepare-dois:
name: Prepare Matrix Output of DOIs
needs: [get-dimensions]
runs-on: ubuntu-24.04
outputs:
dois: ${{ steps.step1.outputs.matrix }}
env:
DOI: ${{ needs.get-dimensions.outputs.dois }}
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,get-dimensions]
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}}" -message "${{needs.get-dimensions.outputs.message}}" >> $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
with:
ref: main
- 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 and Push Changes
id: commit-and-push
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'Update harvested DOIs'
file_pattern: '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}}'