Update DOIs for changed Posts #12911
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: Update DOIs for changed Posts | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "*/10 * * * *" | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.23' | |
- name: Download posts not indexed recently | |
run: | | |
mkdir -p upload | |
curl https://api.rogue-scholar.org/posts/updated?per_page=10 > upload/posts.json | |
- name: Set number of posts to be updated as variable | |
id: current_number | |
run: | | |
echo "NUMBER=$(jq '."total-results"' upload/posts.json)" >> $GITHUB_OUTPUT | |
- name: Install commonmeta | |
if: ${{ fromJSON(steps.current_number.outputs.NUMBER) > 0 }} | |
run: | | |
go install github.com/front-matter/commonmeta@latest | |
commonmeta -v | |
- name: Set current date as variable | |
if: ${{ fromJSON(steps.current_number.outputs.NUMBER) > 0 }} | |
run: | | |
echo "NOW=$(date +'%s')" >> $GITHUB_OUTPUT | |
id: current_date | |
- name: Convert posts to commonmeta | |
if: ${{ fromJSON(steps.current_number.outputs.NUMBER) > 0 }} | |
run: | | |
commonmeta list upload/posts.json -f jsonfeed > upload/commonmeta.json | |
- name: Update Crossref DOIs | |
if: ${{ fromJSON(steps.current_number.outputs.NUMBER) > 0 }} | |
run: | | |
commonmeta push upload/commonmeta.json -f commonmeta -t crossrefxml --depositor "${{ secrets.CROSSREF_DEPOSITOR_NAME }}" --email "${{ secrets.CROSSREF_DEPOSITOR_EMAIL }}" --registrant "${{ secrets.CROSSREF_REGISTRANT }}" --login_id "${{ secrets.CROSSREF_USERNAME_WITH_ROLE }}" --login_passwd "${{ secrets.CROSSREF_PASSWORD }}" --legacyKey "${{ secrets.SUPABASE_KEY }}" > upload/response.json | |
cat upload/response.json | |
- name: update InvenioRDM content | |
if: ${{ fromJSON(steps.current_number.outputs.NUMBER) > 0 }} | |
run: | | |
commonmeta push upload/commonmeta.json -f commonmeta -t inveniordm --host rogue-scholar.org --token ${{ secrets.INVENIORDM_TOKEN }} > upload/response.json | |
cat upload/response.json | |
echo "UUIDS=$(jq -rc '[.[] | .uuid] | join(",")' upload/response.json)" >> $GITHUB_OUTPUT | |
id: response | |