Skip to content

Create v2 data dump #16

Create v2 data dump

Create v2 data dump #16

name: Create v2 data dump
on:
workflow_dispatch:
inputs:
v1-dump:
type: string
description: Name of the v1 dump zip file to convert to v2 (without zip extension, ex v1.33-2023-09-21-ror-data)
jobs:
generate-dump:
runs-on: ubuntu-latest
steps:
- name: Echo message
id: echo_message
run: echo "Github convert v1 dump to v2 action triggered with input v1 dump ${{github.event.inputs.v1-dump}}"
- name: checkout ror data test repo
uses: actions/checkout@v2
with:
path: ./ror-data-test
- name: checkout ror data repo
uses: actions/checkout@v2
with:
repository: ror-community/ror-data
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
path: ./ror-data
- name: checkout ror curation ops repo
uses: actions/checkout@v2
with:
repository: ror-community/curation_ops
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
path: ./curation_ops
- name: copy v1 dump file
id: copyv1dump
run: |
mkdir ./curation_ops/v2_crosswalk/V1_INPUT
mkdir ./curation_ops/v2_crosswalk/V2_OUTPUT
cp -R ./ror-data/${{github.event.inputs.v1-dump}}.zip ./curation_ops/v2_crosswalk/V1_INPUT
- name: Set up Python environment
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: execute script
id: gendumpscript
run: |
cd ./curation_ops/v2_crosswalk
python crosswalk.py -i ./V1_INPUT/ -o ./V2_OUTPUT/ -v 2 -f ./V1_INPUT/${{github.event.inputs.v1-dump}}.zip -d ../created_last_modified/${{github.event.inputs.v1-dump}}_created_last_mod.csv
- name: cat error file
if: ${{ steps.gendumpscript.outcome != 'success'}}
run: |
echo "ERRORS found:"
cat errors.log
- name: copy new data dump file
id: copynewdump
run: |
yes | cp -rf ./curation_ops/v2_crosswalk/V1_INPUT/${{github.event.inputs.v1-dump}}.zip ./ror-data-test
- name: commit dump file
id: commitdumpfile
if: ${{ steps.copynewdump.outcome == 'success'}}
run: |
cd ./ror-data-test
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add ${{github.event.inputs.v1-dump}}.zip
git commit -m "add new data dump file"
git push origin main
- name: Notify Slack
if: always()
uses: edge/simple-slack-notify@master
env:
SLACK_WEBHOOK_URL: ${{ secrets.CURATOR_SLACK_WEBHOOK_URL }}
with:
channel: '#ror-curation-releases'
color: 'good'
text: 'DEV Data dump ${{github.event.inputs.new-release}} generation status: ${{ steps.commitdumpfile.outcome }} Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}'