File tree Expand file tree Collapse file tree 3 files changed +64
-3
lines changed
Expand file tree Collapse file tree 3 files changed +64
-3
lines changed Original file line number Diff line number Diff line change 1+ name : Auto-update CITATION.cff
2+
3+ on :
4+ release :
5+ types : [published]
6+
7+ jobs :
8+ update-citation :
9+ runs-on : ubuntu-24.04
10+
11+ strategy :
12+ max-parallel : 4
13+ matrix :
14+ python-version : [3.13]
15+
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v4
19+
20+ - name : Set up Python ${{ matrix.python-version }}
21+ uses : actions/setup-python@v5
22+ with :
23+ python-version : ${{ matrix.python-version }}
24+
25+ - name : Install doi2cff
26+ run :
27+ pip install
28+ git+https://github.com/citation-file-format/doi2cff
29+
30+ - name : Fetch latest Zenodo DOI
31+ env :
32+ ZENODO_TOKEN : ${{ secrets.ZENODO_TOKEN }}
33+ run : |
34+ python etc/scripts/fetch_latest_doi.py > latest_doi.txt
35+ echo "Latest DOI: $(cat latest_doi.txt)"
36+
37+ - name : Update CITATION.cff
38+ run : doi2cff update $(cat latest_doi.txt)
39+
40+ - name : Commit updated CITATION.cff
41+ run : |
42+ git config user.name "github-actions"
43+ git config user.email "[email protected] " 44+ git add CITATION.cff
45+ git commit -m "Update CITATION.cff with latest Zenodo DOI"
46+ git push origin HEAD:develop
Original file line number Diff line number Diff line change @@ -13,6 +13,3 @@ authors:
1313 - name : ' nexB Inc. and others.'
1414license : Apache-2.0
1515url : ' https://github.com/aboutcode-org/scancode-toolkit'
16- # version: <ToDo>
17- # date-released: <ToDo>
18- # doi: <ToDo>
Original file line number Diff line number Diff line change 1+ import requests
2+ import os
3+
4+ CONCEPT_DOI = "10.5281/zenodo.16361290"
5+ ZENODO_API = "https://zenodo.org/api/records"
6+ TOKEN = os .getenv ("ZENODO_TOKEN" )
7+
8+ params = {
9+ "q" : f"conceptdoi:{ CONCEPT_DOI } " ,
10+ "sort" : "version" ,
11+ "size" : 1 ,
12+ "access_token" : TOKEN
13+ }
14+
15+ r = requests .get (ZENODO_API , params = params )
16+ r .raise_for_status ()
17+ latest_record = r .json ()["hits" ]["hits" ][0 ]
18+ print (latest_record ["doi" ])
You can’t perform that action at this time.
0 commit comments