forked from FAIR-by-Design-Methodology/templates
-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (38 loc) · 1.15 KB
/
helper-get-zenodo-collection-id.yml
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
name: Get Zenodo deposit collection
on:
workflow_dispatch:
workflow_call:
jobs:
get_collection_id:
name: Get collection
runs-on: ubuntu-22.04
outputs:
collection_id: ${{ steps.zenodo_api.outputs.COLLECTION }}
steps:
- name: Checkout master
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- name: Set up Python
uses: actions/setup-python@v4
with:
cache: 'pip'
cache-dependency-path: requirements.txt
python-version: '3.9'
- name: Install Python dependencies
run: pip install requests
- name: Get current DOI
uses: mikefarah/[email protected]
with:
cmd: "echo doi=$(yq '.doi' CITATION.cff) >> $GITHUB_ENV"
- name: Get collection ID from Zenodo API
id: zenodo_api
run: |
collection_id=$(ZENODO_SANDBOX=true DOI=$env.doi python ./.github/scripts/get_zenodo_collection.py)
if [[ $? -eq 0 ]]; then
echo "The collection ID is: ${collection_id}"
echo "COLLECTION=$collection_id" >> "$GITHUB_OUTPUT"
else
exit 1
fi